I made a part of the program like below the only problem is that when i click backspace to input password it adds a * instead of deleting one and also when the password is incorrect it gives u another chance but it starts with a * which means if i entered the password wrong it grants me to try again but instead of a blank space it starts with *
bool Pass()//This Function's purpose is to not allow any person to park in the faculty reserved area, but only those who have the password needed.
{
int counter = 0;
string pass = "";
char ch;
cout << "Please enter the password to access the faculty area\n";
ch = _getch();
do {
while ( ch!=13) {//character 13 is enter
pass.push_back(ch);
cout << '*';
ch = _getch();
}
if (pass == "123") {
cout << "\nAccess granted \n";
returntrue;
}
else {
cout << "\nAccess Aborted. " << 3 - counter << " Attempts Left\n";
counter++;
}
pass = "";
ch = 0;
} while (counter < 4);
cout << "Due to your unverification of your I.D., you will not have access to the faculty reserved slots. \n You will have to park in the students' area.\n\n";
returnfalse;
If the user presses backspace you need to remove the last char from pass.
To remove the * from the screen you need to find a way to move the cursor backward and output a space.