Ok so first of all you don't need to define the password as a string and then make the comparison, it's kind of a waste of code, unless you are going to use it somewhere else. You're better off comparing it right away. Eg:
Code:
If (UserInput == "03j14a86c")
2) Instead of , try
Code:
getline(cin, UserInput)
That way, the whole lne will be "read" and your program won't assume you inserted 2 passwords in case you insert a space while typing it.
3) In order to provide the user with 3 tries, you need to make a loop. Personally I'm used to while loops in this kind of situations. Eg:
Code:
while(NumberOfTries != 3)
{
if(/*Your comparison*/)
{
cout << "The password is correct";
break;
}
}
Now add yourself what you think that should be added in order to make it work.