好吧,初学者,放松一下。谢谢。为什么一个循环在C++中做到这一点
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
int x = 0;
bool while1 = true;
while (while1)
{
cout << x << "\n";
sleep(200);
if (x < 10)
{
while1 = true;
}
else if (x >= 10)
{
while1 = false;
}
x = x+1;
}
cin.get();
}
好了,所以我不明白为什么程序甚至会X 10,如果我有if语句检查前如果x < 10我有1添加到x ...请解释。
缩进,缩进,缩进... – 2013-05-03 05:29:59
'while = false;'你确定这段代码编译了吗? – 2013-05-03 05:30:33
这甚至不会编译。以这个+标识开头 – SomeWittyUsername 2013-05-03 05:31:00