全文预览

100C经典例题

上传者:相惜 |  格式:pdf  |  页数:65 |  大小:3821KB

文档介绍
e(fp);\r)\rp?100ú\r?LXÏû§ÏûL3 üýlþÙÚÛ$%¹T#_ôÿ 0@P`@p?\n@\r??.\r\n@\r?? “stud”"#\r1 .&'()\r2 .&'*+,)\r# include "stdio.h"\rstruct student\r{ char num[6];\rchar name[8];\rint score[3];\rfloat avr;\r} stu[5];\rmain()\r{int i,j,sum;\rFILE*fp;\r/* input*/\rfor]=0;iv5;i+ + )\r{ printf("\n please input No. %d score:\n",i);\rpnntfC@stuNo:M);\rscanf(n%s",stu[i].num);\rprintf("name:");\rscant (M % s", st u [ i ]. n am e);\rsum=0;\rfor(j=0;j<3;j+ + )\r{ printf("score %d.",j+1);\rscanf(M%d",&stu[i].score[j]);\rsum+ = stu[i].score[j];\r)\rstu[i].avr= sum/3.0;\r)\rfp=fopen("stud","wn);\rfor(i=0;i<5;i+ + )\rif(fwrite(&stu[i],sizeof(struct student), 1,fp)!=1)\rprintf(Hfile write error\n");\rfclose(fp);

收藏

分享

举报
下载此文档