0
how can we create stars instead of text in password column in c++
i mean to say that i have created a login password in c++ but i don't know how to make stars instead of text in password column like i have done in java
4 Respuestas
+ 12
Make it that for every input you get the '*' instead. It's not that hard, try it out
+ 1
but how?? plz elaborate
+ 1
Read every character instead of line. And put the "backspace" ( ASCII 08 ) and * to the console.
// I'm not sure it is work. Improve it by yourself
byte [ ] b = new byte [1];
String s = "" ;
while ( b [0] != 10 ) {
System.in.read ( b, 0, 1 );
s += b [0];
System.out.write ( 8 ) ;
System.out.print ( '*' ) ;
}
0
char s[20];
int i = 0;
while(i < 20)
{
if (s[i] = _getch())
cout << "*";
i++;
}
you can modify it to your code, but the inside if statement is easy way to get it done.