+ 1

A little problem.

When you enter " 1 " you can see immediately 2 answers. How to fix it? https://code.sololearn.com/cWfefDYe1CWf/?ref=app

29th Mar 2020, 7:26 PM
tOPovIY_poDRosTok2009rus
tOPovIY_poDRosTok2009rus - avatar
2 Respostas
+ 5
#include <iostream> using namespace std; int main() { int a; cout<< "Hi. Please, choose right answer. \n \n \n"; cout<< "1. The formula of water?" <<endl <<endl; cout<< "1 - H2O 2 - HCl" <<endl <<endl <<endl <<endl; cin>>a; if (a == 1) { cout<< "Right!"; } else if (a == 2) { cout<< "Not right!"; } else { cout<< "Here is only 2 answers."; } return 0; }
29th Mar 2020, 7:30 PM
Cmurio
Cmurio - avatar
31st Mar 2020, 2:54 PM
J. B. Harandra
J. B. Harandra - avatar