Sup, I'm trying to make it so that when someone inputs a password into my program, the input is replaced with asterisks as they type, like most computers do. Does anyone know how I can accomplish this? Here is the code that asks for and compares the password:
--------------------------------------------------------------------------
int main()
{
{
int password;
int numtries = 0;
{
cout << "PLEASE TYPE IN THE PASSWORD...\nPASSWORD: ";
password:
cin >> password;
cerr << "LOGGING IN";
sleep(1);
cerr << ".";
sleep(1);
cerr << ".";
sleep(1);
cerr << ".\n";
sleep(1);
if (password == 2090407)
{
cout << "PASSWORD VERIFIED...\n";
goto verystart;
}
else
{
numtries = numtries + 1;
if (numtries == 5)
{
cout << "PASSWORD DENIED...\nSYSTEM LOGGING OUT...\n";
return 0;
}
}
cout << "PASSWORD DENIED, PLEASE TRY AGAIN...\n";
goto password;
}
-------------------------------------------------------------------------------
I'd appreciate any help. Thanks.
--------------------------------------------------------------------------
int main()
{
{
int password;
int numtries = 0;
{
cout << "PLEASE TYPE IN THE PASSWORD...\nPASSWORD: ";
password:
cin >> password;
cerr << "LOGGING IN";
sleep(1);
cerr << ".";
sleep(1);
cerr << ".";
sleep(1);
cerr << ".\n";
sleep(1);
if (password == 2090407)
{
cout << "PASSWORD VERIFIED...\n";
goto verystart;
}
else
{
numtries = numtries + 1;
if (numtries == 5)
{
cout << "PASSWORD DENIED...\nSYSTEM LOGGING OUT...\n";
return 0;
}
}
cout << "PASSWORD DENIED, PLEASE TRY AGAIN...\n";
goto password;
}
-------------------------------------------------------------------------------
I'd appreciate any help. Thanks.