parent
40985813ea
commit
d927332ce6
@ -1,50 +0,0 @@
|
||||
void xiugaimima()
|
||||
{
|
||||
char temp_mima[6+1],temp_mima1[6+1],temp_mima2[6+1];
|
||||
int i,j;
|
||||
FILE *fp=fopen("users.txt","r");
|
||||
FILE *fpr=fopen("xgmm.txt","w");
|
||||
printf("请输入原来的密码:");
|
||||
scanf("%s",temp_mima);
|
||||
for(j=0;j<n;j++)
|
||||
{
|
||||
fscanf(fp,"%s %s %f\n",&zh[j].gUser,&zh[j].gMima,&zh[j].YuE);
|
||||
if(j==h)
|
||||
{
|
||||
for(i=0;i<3;i++)
|
||||
{
|
||||
if(strcmp(temp_mima,zh[j].gMima)==0)
|
||||
{
|
||||
printf("密码正确!\n");
|
||||
printf("请输入新密码!");
|
||||
scanf("%s",temp_mima1);
|
||||
printf("请再次输入密码确认!");
|
||||
scanf("%s",temp_mima2);
|
||||
if(strcmp(temp_mima1,temp_mima2)==0)
|
||||
{
|
||||
printf("修改密码成功!\n请牢记密码!\n");
|
||||
strcpy(zh[j].gMima,temp_mima1);
|
||||
fprintf(fpr,"%s %s %f\n",zh[j].gUser,zh[j].gMima,zh[j].YuE);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("输入密码不一致!\n请重输!");
|
||||
fclose(fp);fclose(fpr);
|
||||
xiugaimima();break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("密码错误!\n");
|
||||
fclose(fp);fclose(fpr);
|
||||
xiugaimima();break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else fprintf(fpr,"%s %s %f\n",zh[j].gUser,zh[j].gMima,zh[j].YuE);
|
||||
}
|
||||
fclose(fp);fclose(fpr);
|
||||
remove("users.txt");
|
||||
rename("xgmm.txt","users.txt");
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
void qukuan()
|
||||
{
|
||||
float m;
|
||||
int i,u;
|
||||
FILE *fp=fopen("users.txt","r");
|
||||
FILE *fpw=fopen("qukuan.txt","w");
|
||||
printf("请输入您的取款金额: ");
|
||||
scanf("%f",&m);
|
||||
for(i=0;i<n;i++)
|
||||
{
|
||||
fscanf(fp,"%s %s %f\n",&zh[i].gUser,&zh[i].gMima,&zh[i].YuE);
|
||||
if(i==h)
|
||||
{
|
||||
if(m<=zh[i].YuE)
|
||||
{
|
||||
printf("取款成功!\n");
|
||||
printf("请取走您的钞票。\n");
|
||||
zh[i].YuE=zh[i].YuE-m;
|
||||
u=i;
|
||||
fprintf(fpw,"%s %s %f\n",zh[i].gUser,zh[i].gMima,zh[i].YuE);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("您的余额不足,请重新输入。\n");
|
||||
fclose(fp);fclose(fpw);
|
||||
qukuan();break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(fpw,"%s %s %f\n",zh[i].gUser,zh[i].gMima,zh[i].YuE);
|
||||
}
|
||||
}
|
||||
printf("您的当前余额:%.3f\n",zh[u].YuE);
|
||||
fclose(fp);fclose(fpw);
|
||||
remove("users.txt");
|
||||
rename("qukuan.txt","users.txt");
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
void cunkuan()
|
||||
{
|
||||
int i,u;
|
||||
float m;
|
||||
FILE *fp=fopen("users.txt","r");
|
||||
FILE *fpt=fopen("cunkuan.txt","w");
|
||||
printf("请输入您的存款金额: ");
|
||||
scanf("%f",&m);
|
||||
for(i=0;i<n;i++)
|
||||
{
|
||||
fscanf(fp,"%s %s %f\n",&zh[i].gUser,&zh[i].gMima,&zh[i].YuE);
|
||||
if(i==h)
|
||||
{
|
||||
printf("存款成功!\n");
|
||||
zh[i].YuE=zh[i].YuE+m;
|
||||
u=i;
|
||||
printf("您的当前余额:%.3f\n",zh[u].YuE);
|
||||
fprintf(fpt,"%s %s %f\n",zh[i].gUser,zh[i].gMima,zh[u].YuE);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(fpt,"%s %s %f\n",zh[i].gUser,zh[i].gMima,zh[i].YuE);
|
||||
}
|
||||
}
|
||||
fclose(fp);fclose(fpt);
|
||||
remove("users.txt");
|
||||
rename("cunkuan.txt","users.txt");
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
void chaxun()
|
||||
{
|
||||
int i;
|
||||
FILE *fp=fopen("users.txt","r");
|
||||
for(i=0;i<n;i++)
|
||||
{
|
||||
fscanf(fp,"%s %s %f\n",&zh[i].gUser,&zh[i].gMima,&zh[i].YuE);
|
||||
if(i==h)
|
||||
{
|
||||
printf("您的当前余额为:%f\n",zh[h].YuE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
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);
|
||||
}
|
Binary file not shown.
Loading…
Reference in new issue