}
/*函数功能:冻结用户账号*/ void lock() { int i; FILE * fp; char random[20]; srand( (unsigned) time(NULL) ); //随机器 for(i=0; i<12; i++) { random[i]=rand()0; //产生12个随机数 } random[i]='\\0'; strcpy(user[f].num,random); //将产生的随即数替换用户的账号实现将用户账户冻结 if ((fp=fopen(\ //重写数据 { printf(\ exit(0); } for(i=0; i
void save_info() { int i; FILE * fp; if ((fp=fopen(\ //将信息保存到用户文件
件 }
{ }
printf(\exit(0);
for(i=0;i
if ((fp=fopen(\//将信息保存到所以用户文{ }
printf(\exit(0);
for(i=0;i
6.3 解除被冻结用户 /*解除被冻结用户*/ #include
char num[20]; char name[10]; char password[7]; float balance; }user[N];
int main() {
int i; FILE * fp;
if((fp=fopen(\ { printf(\ exit(0); } i=0; while(!feof(fp)) { fread(&user[i],sizeof(struct User),1,fp); i++; } i=i-1;
fclose(fp);
if((fp=fopen(\ { printf(\ exit(0); } for(i=0;i 6.4 用户注册 /*用户注册文件*/ #include { char num[20]; char name[10]; char password[7]; float balance; }user[N]; int main() { int i; FILE * fp; //输入注册信息 for(i=0;i fclose(fp); if((fp=fopen(\ { printf(\ } for(i=0;i fclose(fp); printf(\注册成功!\ /*读取用户信息:检查是否成功*/ if((fp=fopen(\ { printf(\ exit(0); } i=0; while(!feof(fp)) { fread(&user[i],sizeof(struct User),1,fp); i++; } i=i-1; fclose(fp); printf(\ for(i=0;i