下面的代码应该询问用户他的体重,如果用户将> 15,如果你把> 15,它不会做它应该做一个while循环将其提高到50 代码编译成功,但无论while循环。While循环和CIN
#include <iostream>
using namespace std;
int main()
{
int weight;
cout << "Current weight?" << endl;
cin >> weight;
cout << "Your weight:" << weight << endl;
if (weight > 15) {
while (weight == 50) {
weight = weight + 1;
cout << "Weight:" << weight << endl;
}
}
return 0;
}
它做while循环..其唯一的打印在50 –