该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#include
#include
#include
void Password(const char * PW_SAVED);
main()
{
char password[20];
char key[20]="lyt123456";
int j,t,k;
for(j=0;j<=2;++j)/*该循环使只有三次输入机会*/
{
Password(&password);
if(strcmpi(password,key)==0)/*..正确时候 的情况..*/
{
printf("\n恭喜发财,你猜对了我的密码了");
break;
}
printf("\n");
if(j==3&&strcmpi(password,key)!=0)
{
printf("看来你不是本人,请退出\n");
exit(0);
}
}
}
void Password(const char * PW_SAVED)
{
char password[20]; char ch;
int i = 0;
printf(" \n Please Enter the Password : \n");
ch = getch();
while ( (ch & 0xff) != 13)
{
if ( (ch & 0xff) == 8)
{ printf("%c %c",ch,ch);
i--; }
else
{
printf("*");
password[i] = ch;
i++;
}
ch = getch(); }
password[i]='\0';
}