全文预览

C语言经典程序

上传者:梦溪 |  格式:pdf  |  页数:59 |  大小:4973KB

文档介绍
se(fp);\r)\r\r?1009HTÄû œTÄû93 üý_þ ÚÛÜ4V®CO`ÿ 0@P\r`@p?\n@\r??\r\n@\r?? “stud”!"\r1 .%&'(\r2 .%&)*+(\r# include "stdio.hH\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(i=0;i<5;i+ + )\r{ printf("\n please input No. %d score:\n",i);\rprintf(MstuNo:");\rscanf (",s”,stu[ i] .num);\rprintfC^ame:");\rscanf (",s”,stu[ i] .name);\rsum=0;\rfor(j=0;j<3;j+ + )\r{ printf("score %d.H,j+1);\rscanf("%dn,&stu[i].score[j]);\rsum+ = stu[i].score[j];\r)\rstu[i].avr=sum/3.0;\r)\rfp=fopen("stud","w'');\rfor(i=0;i<5;i+ + )\rif(fwrite(&stu[i],sizeof(struct student),1,fp)!= 1)\rprintf("file write error\n");\rfclose(fp);\r)

收藏

分享

举报
下载此文档