You must turn off character echoing when you read the user's input and, for each character input, you'll need to output an "*" instead. Of course then you need to handle specially the backspace key, left/right arrows, home/end, etc.
The actual implementation depends on your OS. For DOS getch() or getche() (I can't remember which) does the trick. For Un*x you have to turn off terminal echoing on stdin via termios settings.
You can use something like character=getch();. It will get the value of the character that you type, but it will not display it. Then you can just use conditional statements to display an "*". And as mentioned above, you need to set the backspace key, left/right arrows, home/end, etc. manually...
If you read the user's input with getch(), the characters entered are not automatically echoed to the screen. So if you use this function, then any time the user enters a character, you can cout << '*' << flush to print an asterisk instead.
However, you will have to write special code to handle keypresses such as Backspace, home/end, left/right arrows, and enter.