|
|
|
@ -146,8 +146,12 @@ void seek() {
|
|
|
|
|
int i = 0, item;
|
|
|
|
|
char s1[13], s2[20];
|
|
|
|
|
lable1:
|
|
|
|
|
printf("请输入卡号:\n");
|
|
|
|
|
printf("请输入卡号(输入0返回主菜单):\n");
|
|
|
|
|
scanf("%s", &s1);
|
|
|
|
|
if(s1=0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
|
if (strcmp(s[i].no, s1) == 0) {
|
|
|
|
|
printf("请输入密码:\n");
|
|
|
|
@ -175,6 +179,52 @@ void seek() {
|
|
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
void save()
|
|
|
|
|
{
|
|
|
|
|
int j = 0,flag=0;
|
|
|
|
|
FILE * fp;
|
|
|
|
|
if ((fp = fopen("a.txt", "r")) == NULL) return;
|
|
|
|
|
stu s;
|
|
|
|
|
while (fscanf(fp, "%s %s %s %s %d", &s[j].no, &s[j].name, &s[j].sex[j], &s[j].passwd, &s[j].balance) == 5) {
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
n = j;
|
|
|
|
|
int i = 0, item,save;
|
|
|
|
|
char s1[13], s2[20];
|
|
|
|
|
lable1:
|
|
|
|
|
printf("请输入卡号(输入0返回主菜单):\n");
|
|
|
|
|
scanf("%s", &s1);
|
|
|
|
|
if(s1=0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
|
if (strcmp(s[i].no, s1) == 0) {
|
|
|
|
|
printf("请输入密码:\n");
|
|
|
|
|
scanf("%s", &s2);
|
|
|
|
|
if (strcmp(s[i].passwd, s2) == 0) {
|
|
|
|
|
printf("请输入您要存款的金额:");
|
|
|
|
|
scanf("%d",&save);
|
|
|
|
|
fprintf(fp, "%s %s %s %s %d \n", s[i].no, s[i].name, s[i].sex,s[i].passwd, s[i].balance = s[i].balance+save);
|
|
|
|
|
printf("存款成功!")
|
|
|
|
|
printf("当前余额为%d元",s[i].balance);
|
|
|
|
|
flag = 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("您输入的密码错误,请重新输入\n");
|
|
|
|
|
goto lable1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag != 2) {
|
|
|
|
|
printf("您输入的用户名不存在,请重新输入\n");
|
|
|
|
|
goto lable1;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
void fileWrite(int n, stu s) {
|
|
|
|
|
FILE *fp1;
|
|
|
|
|
int i;
|
|
|
|
|