I have been trying to make a program that asks for username and password, and if it is wrong it will loop back to the top. But i only want it to loop a set number of times, how can i do this?
this is my code so far
make a 'tries' variable, increment it everytime the user enters his username or password, if he enters the wrong username or password more that 'certain amount of times' then break out of the loop.
1 2 3 4 5 6 7 8 9 10 11
string username;
cin>>username;
string password;
cin>>password;
++tries;
if ( tries >= 3 )
{
cout<<"Login limit exceeded , please try again in 10 minutes"<<endl;
//blah blah blah
}