|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
#include<conio.h>
|
|
|
|
|
#define BUFFERSIZE 1024
|
|
|
|
|
#define MAXACCOUNT 1000
|
|
|
|
|
#define ADMINISTRATIOR 123456
|
|
|
|
|
|
|
|
|
|
typedef struct bankaccount//<2F><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>ʽ
|
|
|
|
|
{
|
|
|
|
|
int account;
|
|
|
|
|
int key;
|
|
|
|
|
char name[32];
|
|
|
|
|
float balance;
|
|
|
|
|
}BANKACCOUNT;
|
|
|
|
|
BANKACCOUNT accountcollection[MAXACCOUNT];
|
|
|
|
|
int cur_account = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void insert_account(FILE *fp, int accountnum)//<2F>½<EFBFBD><C2BD>˻<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
BANKACCOUNT newaccount;
|
|
|
|
|
newaccount.account = accountnum;
|
|
|
|
|
int subkey;
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
printf(">><3E><><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>Ϊ:");
|
|
|
|
|
printf("%d\n", accountnum);
|
|
|
|
|
printf(">><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&(newaccount.key));
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ղŵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺\n");
|
|
|
|
|
do{
|
|
|
|
|
scanf("%d", &subkey);
|
|
|
|
|
getchar();
|
|
|
|
|
if (subkey == newaccount.key)
|
|
|
|
|
break;
|
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>ε<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD>˳<EFBFBD>ע<EFBFBD><EFBFBD>\n");
|
|
|
|
|
}while (subkey != 0);
|
|
|
|
|
if (subkey != 0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>óɹ<EFBFBD><EFBFBD><EFBFBD>\n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
printf(">><3E><><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",newaccount.name);
|
|
|
|
|
printf(">><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>:");
|
|
|
|
|
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("<EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
void store_account(FILE*fp)
|
|
|
|
|
{
|
|
|
|
|
int i = 0;
|
|
|
|
|
for(i = 0;i<cur_account-1;i++)
|
|
|
|
|
fprintf(fp,"%d %d %s %.2f\n",
|
|
|
|
|
accountcollection[i].account,accountcollection[i].key,accountcollection[i].name,accountcollection[i].balance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void get_account(FILE *fp)//<2F><>ѯ<EFBFBD>˺<EFBFBD><CBBA><EFBFBD>Ϣ
|
|
|
|
|
{
|
|
|
|
|
int accountnum;
|
|
|
|
|
int key;
|
|
|
|
|
char name[32];
|
|
|
|
|
float balance;
|
|
|
|
|
int i =0,j;
|
|
|
|
|
char buffer[BUFFERSIZE];
|
|
|
|
|
int len;
|
|
|
|
|
cur_account = 0;
|
|
|
|
|
|
|
|
|
|
fseek(fp,0,SEEK_SET);
|
|
|
|
|
while(!feof(fp)) // <20><>Ϊfeof()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD>飬<EFBFBD><E9A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>curAccount<6E><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1
|
|
|
|
|
{
|
|
|
|
|
fscanf(fp,"%d %d %s %f",&accountnum,&key,name,&balance);
|
|
|
|
|
accountcollection[cur_account].account = accountnum;
|
|
|
|
|
accountcollection[cur_account].key = key;
|
|
|
|
|
strcpy(accountcollection[cur_account].name ,name);
|
|
|
|
|
accountcollection[cur_account].balance = balance;
|
|
|
|
|
cur_account++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void list_account(FILE *fp)
|
|
|
|
|
{
|
|
|
|
|
int i =0;
|
|
|
|
|
printf("<EFBFBD>ϼ<EFBFBD>%d<><64><EFBFBD>˺<EFBFBD>:\n",cur_account-1);// cur_account<6E><74>ȥ<EFBFBD><C8A5><EFBFBD>ӵ<EFBFBD>1
|
|
|
|
|
for(i = 0;i< cur_account-1;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>%d:\n",i+1);
|
|
|
|
|
printf("<EFBFBD>˺<EFBFBD>:%d\n",accountcollection[i].account);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\n",accountcollection[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%.2f\n",accountcollection[i].balance);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int search_key(FILE *fp,int key,int i)
|
|
|
|
|
{
|
|
|
|
|
if (accountcollection[i].key == key)
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int search_account(FILE *fp,int accountnum,int flag)
|
|
|
|
|
{
|
|
|
|
|
int i =0;
|
|
|
|
|
for(i = 0;i< cur_account-1;i++)
|
|
|
|
|
{
|
|
|
|
|
if(accountcollection[i].account == accountnum)
|
|
|
|
|
{
|
|
|
|
|
if(flag == 1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>%d:\n",i+1);
|
|
|
|
|
printf("<EFBFBD>˺<EFBFBD>:%d\n",accountcollection[i].account);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\n",accountcollection[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%.2f\n",accountcollection[i].balance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return i + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
void del_account(FILE *fp,int accountnum)
|
|
|
|
|
{
|
|
|
|
|
int i, key;
|
|
|
|
|
if(search_account(fp,accountnum,1)==0)
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
i = search_account(fp,accountnum,0) - 1;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&key);
|
|
|
|
|
while (!search_key(fp, key, i) && key != 0)
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>\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("ע<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf("ע<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int accountnum;
|
|
|
|
|
int i;
|
|
|
|
|
float withdraw, store;
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
system("cls"); //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
puts("********************************************");
|
|
|
|
|
puts("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
puts("1 : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD> ");
|
|
|
|
|
puts("2 : <20><><EFBFBD><EFBFBD>ԱȨ<D4B1><C8A8> ");
|
|
|
|
|
puts("3 : <20><>ѯ<EFBFBD>˻<EFBFBD> ");
|
|
|
|
|
puts("4 : ע<><D7A2><EFBFBD>˻<EFBFBD> ");
|
|
|
|
|
puts("5 : <20><>ȡ<EFBFBD><C8A1> ");
|
|
|
|
|
puts("6 : <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> ");
|
|
|
|
|
puts("********************************************");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&i);
|
|
|
|
|
system("cls"); //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
if (i < 7 && i > 0)
|
|
|
|
|
{
|
|
|
|
|
switch(i)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
if(!(fp = fopen("account.txt","a+")))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d", &accountnum);
|
|
|
|
|
while (search_account(fp,accountnum,0) && accountnum != 0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѱ<EFBFBD>ռ<EFBFBD>ã<EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD>Ż<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d\n", &accountnum);
|
|
|
|
|
}
|
|
|
|
|
if(accountnum != 0)
|
|
|
|
|
insert_account(fp, accountnum);
|
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>!\n<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>!");
|
|
|
|
|
getch();
|
|
|
|
|
fclose(fp);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
if(!(fp = fopen("account.txt","r")))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
long int n;
|
|
|
|
|
scanf("%ld", &n);
|
|
|
|
|
while (n != ADMINISTRATIOR)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>:\n");
|
|
|
|
|
scanf("%ld", &n);
|
|
|
|
|
if (n == 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (n != 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
get_account(fp);
|
|
|
|
|
list_account(fp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><EFBFBD><EFBFBD>!\n<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>:\n");
|
|
|
|
|
scanf("%d",&accountnum);
|
|
|
|
|
if(!(fp = fopen("account.txt","r")))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
get_account(fp);
|
|
|
|
|
if(!search_account(fp,accountnum,1))
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>%d\n",accountnum);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><EFBFBD><EFBFBD>!\n<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>!");
|
|
|
|
|
getch();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>:\n");
|
|
|
|
|
scanf("%d",&accountnum);
|
|
|
|
|
if(!(fp = fopen("account.txt","r")))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
get_account(fp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
if(!(fp = fopen("account.txt","w+")))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
del_account(fp,accountnum);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><EFBFBD><EFBFBD>!\n<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>!");
|
|
|
|
|
getch();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>\n");
|
|
|
|
|
scanf("%d",&accountnum);
|
|
|
|
|
if(!(fp = fopen("account.txt","r")))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
get_account(fp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
if(!(fp = fopen("account.txt","w+")))
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
if(search_account(fp,accountnum,0))
|
|
|
|
|
{
|
|
|
|
|
int i = search_account(fp,accountnum, 0) - 1;
|
|
|
|
|
int key;
|
|
|
|
|
do{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD>˳<EFBFBD><EFBFBD>ù<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d", &key);
|
|
|
|
|
system("cls");
|
|
|
|
|
if(search_key(fp, key, i))
|
|
|
|
|
break;
|
|
|
|
|
}while ( key != 0);
|
|
|
|
|
while (key != 0)
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("********************************************\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뿪ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("0 :<3A>˳<EFBFBD>ѡ<EFBFBD><D1A1>\n");
|
|
|
|
|
printf("1 :ȡ<><C8A1>\n");
|
|
|
|
|
printf("2 :<3A><><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("********************************************\n");
|
|
|
|
|
scanf("%d", &key);
|
|
|
|
|
system("cls");
|
|
|
|
|
if (key >= 0&&key <=2)
|
|
|
|
|
{
|
|
|
|
|
switch(key)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫȡ<EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%f", &withdraw);
|
|
|
|
|
if(accountcollection[i].balance > withdraw)
|
|
|
|
|
{
|
|
|
|
|
accountcollection[i].balance -= withdraw;
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ %.2f<EFBFBD><EFBFBD>\n", accountcollection[i].balance);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
getch();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%f", &store);
|
|
|
|
|
accountcollection[i].balance += store;
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ %.2f<EFBFBD><EFBFBD>\n", accountcollection[i].balance);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
getch();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default :
|
|
|
|
|
printf("<EFBFBD><EFBFBD>лʹ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Чָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 <20><>2<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
store_account(fp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
getch();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
printf("<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Чָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 <20><>6<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}while(i != 6);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|