The code below should ask the user his weight and if the user puts > 15 it should do a while loop to increase it to 50 The code compiles sucessfully but no matter if you put > 15 it wont do the while loop.
#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;
}
Aucun commentaire:
Enregistrer un commentaire