Adding another loop for this code?

Hey guys I just wont to know how add the number of attempts that the user has tried to enter the username and password.So if the user enters a wrong username and password three times the program should terminate.

THANKS.

#include<iostream>
#include<string>

using namespace std;

void main()
{
string pass="23", un="aazir";

cout<<"Enter User Name- "<<endl;
cin>>un;
cout<<"Enter Password- ";
cin>>pass;


if(un == "aazir" )
{
if(pass == "23")
{
cout<<"Welcome "<<un<<endl;
}
}
else
cout<<"Incorrect Username or Password"<<endl;

}
Yes, introduce a loop like for(int i = 0; i < 3; ++i) that spans the the entering process.
Thnk you
Topic archived. No new replies allowed.