parent
86efccb00d
commit
b0e3fbb794
@ -0,0 +1,43 @@
|
||||
void denglu()
|
||||
{
|
||||
FILE *fp=fopen("users.txt","r");
|
||||
char account[10+ 1],password[6 + 1],r;
|
||||
int m=0,i;
|
||||
printf("请输入您的帐号:");
|
||||
scanf("%s",account);
|
||||
printf("请输入您的密码:");
|
||||
scanf("%s",password);
|
||||
while (m<=2) /*判断是否输入错3次了*/
|
||||
{
|
||||
for(i=0;i<=n;i++)
|
||||
{
|
||||
fscanf(fp,"%s %s %f\n",&zh[i].gUser,&zh[i].gMima,&zh[i].YuE);
|
||||
if((strcmp(zh[i].gUser,account)==0)&&(strcmp(zh[i].gMima,password)==0))
|
||||
{
|
||||
system("cls");
|
||||
printf("登陆成功!");
|
||||
fclose(fp);
|
||||
h=i;
|
||||
welcome3();
|
||||
break;
|
||||
}
|
||||
}
|
||||
rewind(fp); /*重新打开文件,进行新一轮的密码验证*/
|
||||
printf("您输入的帐号不存在或密码不正确!\n请重新输入:\n");
|
||||
m++;
|
||||
printf("请输入您的帐号:");
|
||||
fflush(stdin);
|
||||
gets(account);
|
||||
fflush(stdin);
|
||||
printf("请输入您的密码:");
|
||||
fflush(stdin);
|
||||
gets(password);
|
||||
fflush(stdin);
|
||||
}
|
||||
fclose(fp);
|
||||
printf("您输入帐号密码不正确已经3次,您被强制退出系统(按任意键退出)!");
|
||||
fflush(stdin);
|
||||
scanf("%c",&r);
|
||||
fflush(stdin);
|
||||
exit(0);
|
||||
}
|
Loading…
Reference in new issue