When you get input throught the cmd, using cin>>, how can I get the input to be all asterisks instead of the actual letters being typed?
When you get input throught the cmd, using cin>>, how can I get the input to be all asterisks instead of the actual letters being typed?
If you mean a password-like effect, I know that you can use getch() in a loop and output '*' through cout every time.
#edit: getch() is from conio.h. But it may or may not work depending on the compiler.
Last edited by Vorok; 06-09-2003 at 03:51 PM.
There isn't any standard way to do this. getch() is your best bet, but otherwise, you probably need a GUI which you can control.
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
I think that there may be a bit mask function that you can use.
Not quite sure you may want to look into this.
This might be useful...
http://faq.cprogramming.com/cgi-bin/...&id=1043284392
You may also want to try these various methods of limiting what the user inputs ( ex. number of characters, or the validation character ) :
Code:#include <iostream> #include <conio.c> using namespace std; int main() { char ch; char ch2; cout << "Your password ONE should end with an asterisk (*).\n"; cout << "Enter your password :\n>> "; while (ch = getch() != '*') { cout << "*"; } cout << "\n\n\nYour password TWO should be 8 characters long.\n"; cout << "Enter your password :\n>> "; for(int x = 0; x < 8; x++) { ch2 = getch(); cout << "*"; } cout << endl << endl << endl; system("pause"); return 0; }
I couldn't get '\n' to replace '*' successfully. If anyone knows why, share your knowledge !
you can also try my code:
http://darkeldar77.tripod.com/source/Pass.zip