how to enter password three times and count your account is blocked program c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

how to enter password three times and count your account is blocked program c++

8th Feb 2017, 10:37 AM
Aiken Sheky
Aiken Sheky - avatar
2 Answers
+ 7
string user_pass; const string password = "cookies_omg_wow512"; int count = 0; while (count < 3) { cin >> user_pass; if (user_pass != password) { cout << "Not wow." << endl; count++; } else { cout << "Much wow." << endl; break; } } if (count == 3) { cout << "You banned lol" << endl; } else { cout << "Welcome to cookieland" << endl; }
8th Feb 2017, 10:48 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
thank you Hatsy
8th Feb 2017, 10:58 AM
Aiken Sheky
Aiken Sheky - avatar