parent
667a794d5f
commit
4e0551335a
@ -0,0 +1,29 @@
|
|||||||
|
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");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in new issue