loading...

re: C++ stuck inside while-loop? VIEW POST

FULL DISCUSSION
 

Does this work ?

cout << "Enter your weight in kgs: " << flush;
if (!(cin >> weight)) {
    cout << "You did not enter a correct number!" << endl;
    // Leave the program, or do something appropriate:
}

Also make sure to add the #help tag to reach more visibility

code of conduct - report abuse