好吧,初學者,放鬆一下。謝謝。爲什麼一個循環在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