master
m59637281 6 years ago
parent 975f9c3fe5
commit 2d88d3c9fe

@ -0,0 +1,36 @@
#include<stdio.h>
int main(void)
{
struct custom
{
char name[20];
char ID[20];
char card_number[20];
float sum;
}a;
FILE *fp;
char c='Y';
fp=fopen("sum.dat","w");//创建只写文件
while(c=='Y'||c=='y')//判断循环
{
printf("输入姓名:");
scanf("%s",a.name);
getchar();
printf("输入身份证号:");
scanf("%s",a.ID);
printf("输入卡号:");
scanf("%s",a.card_number);
printf("输入余额:");
scanf("%f",&a.sum);
fprintf(fp,"%s%s%s%.2f\n",a.name,a.ID,a.card_number,a.sum);
while(1)
{
printf("继续录入?<Y/N>");
c=getche();
if(c=='Y'||c=='y'||c=='N'||c=='n')
break;
}
}
fclose(fp);
}
Loading…
Cancel
Save