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.
36 lines
1.0 KiB
36 lines
1.0 KiB
void insert_account(FILE *fp, int accountnum)//新建账户
|
|
{
|
|
BANKACCOUNT newaccount;
|
|
newaccount.account = accountnum;
|
|
int subkey;
|
|
|
|
printf("请输入账号信息\n");
|
|
printf(">>您的账号为:");
|
|
printf("%d\n", accountnum);
|
|
printf(">>请您输入密码:");
|
|
scanf("%d",&(newaccount.key));
|
|
system("cls");
|
|
printf("请您再次输入刚才的密码:\n");
|
|
do{
|
|
scanf("%d", &subkey);
|
|
getchar();
|
|
if (subkey == newaccount.key)
|
|
break;
|
|
else
|
|
printf("两次的密码不一样!\n请再次输入第一次的密码或输入0退出注册\n");
|
|
}while (subkey != 0);
|
|
if (subkey != 0)
|
|
{
|
|
printf("密码设置成功!\n 请您完善个人信息\n");
|
|
printf(">>姓名:");
|
|
scanf("%s",newaccount.name);
|
|
printf(">>请您输入初始余额:");
|
|
scanf("%f",&(newaccount.balance));
|
|
fseek(fp,0L,SEEK_END);
|
|
fprintf(fp,"%d %d %s %.2f\n",newaccount.account,newaccount.key,newaccount.name,newaccount.balance);
|
|
printf("账户创建成功!\n");
|
|
}
|
|
else
|
|
printf("创建失败!");
|
|
}
|