You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
846 B

void del_account(FILE *fp,int accountnum)
{
int i, key;
if(search_account(fp,accountnum,1)==0)
printf("无法找到此账户!\n");
else
{
i = search_account(fp,accountnum,0) - 1;
printf("请输入密码\n");
scanf("%d",&key);
while (!search_key(fp, key, i) && key != 0)
{
system("cls");
printf("您输入的密码有误!\n请重新输入或输入0放弃删除\n");
scanf("%d", &key);
}
system("cls");
if (key)
{
for(i = 0;i<cur_account-1;i++)
if(accountcollection[i].account != accountnum)
fprintf(fp,"%d %d %s %.2f\n",
accountcollection[i].account,accountcollection[i].key,accountcollection[i].name,accountcollection[i].balance);
printf("注销成功!\n");
}
else
printf("注销失败!\n");
}
}