【发布时间】:2014-12-13 15:22:25
【问题描述】:
如何才能在 C++ 中显示星号 (*) 而不是纯文本密码。
我要求输入密码,它在屏幕上是通行证。
如何将它们转换为星号(*),以便用户在输入时看不到密码。
这是我目前拥有的
char pass[10]={"test"};
char pass1[10];
textmode(C40);
label:
gotoxy(10,10);
textcolor(3);
cprintf("Enter password :: ");
textcolor(15);
gets(pass1);
gotoxy(10,11);
delay(3000);
if(!(strcmp(pass,pass1)==0))
{
gotoxy(20,19);
textcolor(5);
cprintf("Invalid password");
getch();
clrscr();
goto label;
}
谢谢
【问题讨论】:
-
C++ password masking 的可能重复项
-
另外,this。请 - 不要使用
goto。