📄 password.cpp
字号:
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
int judge()
{int c[200],i,j,t=1,d[10]={'0','7','1','1','7','0','0','4','2',13};
clrscr();
printf("Please input your password:\n");
for(i=0;;i++)
{if((c[i]=getch())==13)break;printf("*");}printf("\n");
for(i=0;i<10;i++)
{t=t*(c[i]==d[i]);}
return t;}
void password()
{int i,j,k;
for(j=0;j<3;j++)
{i=judge();
if(i==1){printf("Password correct! Access!\n");return;}
else{if(j==2){printf("You have input the wrong password for three times, press any key to quit:\n");k=getch();exit(0);}
printf("Password error!\n");loop:printf("Please press a number according to what you want to do:\n1.Reenter your password.\n2.Quit.\n");
k=getche(); printf("\n");
if(k=='2') exit(0);
else if(k!='2'&&k!='1'){printf("You have press a wrong number!\n");goto loop;}
}
}
}
void main()
{int i;
password();
printf("!!\n");
i=getch();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -