0

Nesting not working..

Goodafternoon all :). I have a question. I am trying out nesting into if-statements. Therefore I made a small code: cout << "How old do you think that Mark is? < " << flush; int input; cin >> input; if (input <= 3) { cout << "You are close" << endl; if (input == 4) { cout << "Perfect" << endl; } } else { cout << "Sorry, please try again" << endl; } when I now enter 4 the program returns: sorry please try

4th Mar 2018, 3:22 PM
Sabine Meijran-Prins
Sabine Meijran-Prins - avatar
1 Answer