1. getch(); returns a keycode -> that is a number!
Code:
int temp;
int compare;
string original_password="member";
string new_password;
cout<<"enter your password\n";
int i = 0;
while( ( temp = getch() ) != '\r' )
{
new_password += char(temp); //convert to character
cout << "*";
i++;
}
if(original_password == new_password)
cout<<"correct!";
You need to use an if statement here with the '==' operator because strcmp does not like the two different types of strings. However the code works fine. If you have any questions just ask.