c语言运行窗口能输入,C语言問題怎么给运行窗口弄个像墙一样的东西

struct stu { int num; char name[6]; char sex[3]; int dorm[3]; int tel[8]; } stua[N];

void main()

{ int i,j; FILE*fp;

if((fp=fopen(“A.txt”,"wb+"))==NULL) { printf("can not open the file.\n"); exit(0); }

for(i=0;i

{ printf("请输入数据:");

scanf("%d%s%s%d%d%d",

&stua[i].num,stua[i].name,stua[i].sex,

&stua[i].dorm[0],&stua[i].dorm[1],&stua[i].dorm[2]);

for ( j=0;j<8;j++ ) scanf("%d",,&stua[i].tel[j]);

if ( fwrite(&stua[i],sizeof(struct stu),1,fp)!=1) printf("file write error\n");

}

fclose(fp);

if((fp=fopen("A.txt","rb"))==NULL) {printf("can not open the file"); exit(0);}

for(i=0;i

{ if(fread(&stua[i],sizeof(cstruct stu),1,fp)!=1) printf("file read error\n");

printf("%d %s %s %d %d %d " ,stua[i].num ,stua[i].name ,stua[i].sex,

stua[i].dorm[0],stua[i].dorm[1],stua[i].dorm[2]);

for ( j=0;j<8;j++ ) printf("%d ",stua[i].tel[j] ); printf("\n");

}

fclose(fp);

}

取消

评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值