谁能帮我这个.. [英] can anyone help me with this..

查看:63
本文介绍了谁能帮我这个..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

helloo.
我在此程序中看不到任何错误,我的IDE不会执行任何涉及循环的程序.

谁能建议我如何在c#.net中执行此程序


helloo .
i dont see any erros in this program, My IDE does''t execute any program which involve loops.

can anyone suggest me how can i execute this program in c#.net


 int j = 2;
for (int i = 1; i < 100; i = i * 2)
{
    j = j - i;
    while (j < 25)
    {
        j = j + 5;
    }
}


[edit]删除了虚假代码块-OriginalGriff [/edit]


[edit]Spurious Code block removed - OriginalGriff[/edit]

推荐答案

我的IDE不执行任何涉及循环的程序"
我觉得很难相信!你怎么知道的?

在行上放置一个断点
"My IDE does''t execute any program which involve loops"
I find that extremely difficult to believe! How do you know that?

Put a breakpoint on the line
int j = 2;

运行程序.
当到达断点时,执行将停止.
然后,您可以单步执行程序,在运行时查看变量,并跟踪发生的情况.
我认为您会发现循环已执行...

Run your program.
When it gets to the breakpoint, execution will stop.
You can then single step through your program, looking at the variables as you go, and following what happens.
I think you will find that the loops are executed...


循环(甚至跟您一样怪异的循环)也不会花很长时间来完成.从外观上看,外循环将执行9次,最后,i = 128,而j =25.

遵循Griff所说的-在调试器下运行它,并观察变量的变化.
Loops (even ones as weird as yours) don''t take forever to complete. From the looks of it, the outer loop is going to execute 9 times, and at the end, i = 128, and j = 25.

Do what Griff said - run it under the debugger and watch the variables change.


这篇关于谁能帮我这个..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆