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

6th Feb 2017, 4:30 PM
LOKESH MAHAJAN
LOKESH MAHAJAN - avatar
4 odpowiedzi
+ 12
Make it that for every input you get the '*' instead. It's not that hard, try it out
6th Feb 2017, 4:49 PM
Filip
Filip - avatar
+ 1
but how?? plz elaborate
6th Feb 2017, 5:28 PM
LOKESH MAHAJAN
LOKESH MAHAJAN - avatar
+ 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 ( '*' ) ; }
6th Feb 2017, 6:09 PM
K.C. Leung
K.C. Leung - avatar
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.
7th Feb 2017, 6:58 AM
Chinmay Bhale
Chinmay Bhale - avatar