コード;
# include <iostream>
# include <windows.h>
using namespace std;
int main () {
int var1 = 1;
int var2 = 1;
bool while1 = true;
int x = 0;
while (x < 999) {
x = x+var1;
x = x+var2;
cout << x << " Is the current value of x, how much would you like to add to it?\n";
Sleep(1000);
while (while1) {
int var3;
cin>> var3;
if (var3 > 100) {
cout << "Too large, between 10 and 100\n";
while1 = true;
}
else if (var3 < 10) {
cout << "Too small, between 10 and 100\n";
while1 = true;
}
else{
cout << "Adding " << var3 << " to " << x << "\n";
x = x + var3;
cout << "x is now " << x << "\n";
while1 = false;
}
}
}
}
さて、問題は、最初にループバックした後、2 番目の while ステートメントを完全にスキップして、var1 と var2 だけを x に追加し続けることです。
ここで何が問題なのですか?