void jiaofei()
{ FILE *f;
if((f=fopen("E://jiaofei.txt","a"))!=NULL)
{
int i;
system("cls");
printf("您一共要缴的费用为5000元!\n");
printf("请输入您的学号:\n");
scanf("%s",yonghu[0].num);
printf("请输入您的姓名:\n");
scanf("%s",yonghu[0].name);
system("cls");
printf("请输入您要缴费的金额:\n");
scanf("%d",&yonghu[0].x);
yonghu[0].y=5000-yonghu[0].x;
if(yonghu[0].x>5000)
{printf("您所输入的金额大于您所应当缴费的金额,请重新输入缴费金额!\n");}
else
printf("缴费成功!\n");
printf("您还应当缴的费用为%d",yonghu[0].y);
fprintf(f,"%s ",yonghu[0].num);
fprintf(f,"%s ",yonghu[0].name);
fprintf(f,"%d ",yonghu[0].x);
fprintf(f,"%d\n",yonghu[0].y);
fclose(f);
system("pause");
return;
}
}
void bujiao()
{ int i,n;
int m=0;
char num[20];
FILE *f;
printf("请输入补缴学费学生的学号:\n");
scanf("%s",num);
f=fopen("E://jiaofei.txt","r");
for(i=0; !feof(f) && i<=10000; i++) {
if(fscanf(f,"%s",yonghu[i].num)!=1) break;
if(fscanf(f,"%s",yonghu[i].name)!=1) break;
if(fscanf(f,"%d",&yonghu[i].x)!=1) break;
if(fscanf(f,"%d",&yonghu[i].y)!=1) break;
if(strcmp(num,yonghu[i].num)==0) {
m=1;
printf("学号:%s ",yonghu[i].num);
printf("姓名:%s ",yonghu[i].name);
printf("已缴学费:%d ",yonghu[i].x);
printf("未缴学费:%d\n",yonghu[i].y);
}
}
if(m==0)
printf("查无此人!");
//scanf("%*s");
//fclose(f);
if((f=fopen("E://jiaofei.txt","r+"))!=NULL)
{
printf("请输入您要补缴学费的金额:\n");
scanf("%d",&yonghu[0].x1);
if(yonghu[0].x1>yonghu[0].y)
{printf("您所输入的金额大于您所应当缴费的金额,请重新输入缴费金额!\n");}
else
printf("补缴成功!\n");
printf("您还应当缴的费用为%d",5000-yonghu[0].x-yonghu[0].x1);
fprintf(f,"%s ",yonghu[0].num);
fprintf(f,"%s ",yonghu[0].name);
fprintf(f,"%d ",yonghu[0].x+yonghu[0].x1);
fprintf(f,"%d\n",5000-yonghu[0].x-yonghu[0].x1);
fclose(f);
}
}
DOUBLE_l
相关分类