全文预览

c语言编程经典100例

上传者:你的雨天 |  格式:pdf  |  页数:91 |  大小:4374KB

文档介绍
putchar(c|i]);\r}\rfclose(fp);\r@AB100›\rCDEˆœcžaŸcžˆ3  ¡O|¢aZ[\]^„jQ£¤¥¦ž§a¨©aª ¡|¢«,\rFGM\r¬­|¢a®¯ˆOQ£ŠFGMO¬­RQƒŒ°i\€“stud”Kp\r1 .ABRSE\r2 .ABTUVE\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/Ainput*/\rfbr(i=0;i<5;i++)\r( printf("\n please input No. %d score:\n",i);\rprintf("stuNo:");\rscanf("%s",stu|i].num);\rprintfC'name:n);\rscanf("%s",stu[i].name);\rsum=0;\rfor(j=0;j<3;j++)\r{ printf("score %d.",j+l);\rscanf("%d",&stu[i].score[j]);\rsum+=stu[i] .score[j];\r)\rstu[i].avr=sum/3.0;\rJ\rfpfopen("stud","w");\rfor(i=0;i<5;i++)\rif(fwrite(&stu[i],sizeof(struct student),l,fp)!=l)\rprintf("filc write error\n");\rfclose(fp);

收藏

分享

举报
下载此文档