0

Help me find a way to add the code to a loop so that the user is given 3 chances to enter the username and password correctly.

https://code.sololearn.com/cOMq55Ogd2GU/?ref=app

2nd Aug 2017, 6:56 AM
Nikko Pepito
Nikko Pepito - avatar
3 Antworten
+ 2
maybe use some counter like: int counter = 0; if(loginFailed) counter++; and then write like if(loginSuccess && counter < 3)
2nd Aug 2017, 7:06 AM
Jakub Stasiak
Jakub Stasiak - avatar
+ 2
You could store the amount of attempts in a variable, then check the variable after each try. If variable == 3, then end. Sorry I'm typing this at work, so can't check your code.
2nd Aug 2017, 7:05 AM
Bagshot
Bagshot - avatar
0
thank you so much for the answers. i'm gonna try it.
2nd Aug 2017, 7:10 AM
Nikko Pepito
Nikko Pepito - avatar