環路I需要此代碼到輸出升空!打印到0與在C++
我有一種感覺,我在for循環中將我與userNum相關聯時出錯。有什麼建議麼?
#include <iostream>
using namespace std;
int main() {
int userNum = 0;
int i = 0;
userNum = 3;
for(i = 1; i <= userNum; i--) {
cout << i << endl;
cout << "Blastoff!" << endl;
}
return 0;
}
也許該學習如何使用調試器 –
不應該從userNum開始到0嗎? –
將blastoff移至循環後 –