First, variables like 'a' and 'b' are poorly named. They don't tell me what they are supposed to be, at all.
16:32: error: no match for 'operator!=' (operand types are 'std::string {aka std::basic_string<char>}' and 'int')
You're trying to compare a string to an int for inequality. Explain in words what you want the condition on line 16 to be checking for, because it makes no sense as it stands now.
Also, just a general note: You should always enable compiler warnings. Your a and b variables are not initialized.
the if statements are nonsense: b is not initialized, and && on a pair of strings means 'what' to you?
I would think you want something like this:
1 2 3 4 5 6 7 8
do
{
ask for user name
get user name
ask for password
get password
counter++;
} while (username != valid_user_name && password != valid_users_password && counter < 3)
**where you have a valid login /password to compare the input to.
if counter is good, proceed, else too many attempts, do whatever (exit program?) Note that after the loop counter could be 3 and be valid. its <4 after the loop, because it increments it regardless of good/bad input.