0
How do I hide a password in switch case when inputed
C++
4 odpowiedzi
+ 1
What does jkkk mean?
0
I dosen't mean anything. I was just typing fast
0
You can use a trick for that. Instead of cin you can do this. (if that's what you mean)
string pass="";
char inp;
do{
//get a new character every time the loop runs
inp=cin.get();
//if Enter is pressed exit the loop
if(inp=='\n')break;
//filling the password incerted with the new character
pass+=inp;
//setting the cursor position at the start of the line
cout<<"\r"<<endl;
//replacing the characters that are followed with an asterisk
for(int i=0;i<pass.length();i++)
cout<<'*'<<endl;
}while(true);
...
You can use a backspace action too but I haven't anything that can help in my mind right now
0
Thanks