you want an asterisk to be displayed instead of whatever you are typing? if that is the case...
std::string password = "";
char char1 = ' ';
while (char1 != 27) // 27 is the ascii code for ESCAPE
{ // 13 is for ENTER if that's what you need
char1 = getch();
password += char1;
std::cout << "*" ;
}
the loop will run until you press ESC.
your password goes to the password variable, obviously. (and remember to include the conio.h header in order to use getch).
however, this will add any pressed keys to your password variable. for example, in the code above you will see that the password variable actually contains the ESC ascii symbol at the end, so you'll have to check or remove any unwanted key pressess, but that shouldn't be hard