全文预览

C语言经典编程百例

上传者:梦溪 |  格式:pdf  |  页数:67 |  大小:6079KB

文档介绍
ng : The document was created with Spire.PDF for .NET.\r)\rfclose (fp);\rP?  1001\rQRSxUyz!{UyzS3 |}@~!€W 0?‚ƒ„(…†yz\r‡!ˆ‰!Š|}~)!‹Œo\rŽ~!S@ƒ„[‹Œo@Žƒ^‘VWXY"stud"f\r1.?\r2.?\rSinclude z!stdio. h%\rstruct student\r{ char num[6];\rchar name[8];\rint score[3];\rfloat avr;\r} stu[5];\rmainO\r{int i, j, sum;\rFILE *fp;\r/*input*/\rfor(i=0;i<5;i++)\r{ printf (z!\n please input No. %d score:\nz!, i);\rprintf("stuNo:%)@\rscanf(%%s%!stu[i]. num);\rprintf("name:%)@\rscanf (%%s%!stu[i]. name);\rsum=0;\rfor(j=0;j<3;j++)\r{ printf ("score %d. %!j+1);\rscanf (%Od%, &stu[i]. scoretj]);\rsum+=stu[i]. score[j];\r)\rstu[i]. avr=sum/3. 0;\r)\rfpufopen(%stud%, %w%)@\rfor(i=0;i<5;i++)\rif(fwrite(&stu[i], sizeof(struct student), 1, fp) !=1)\rprintf (zzfile write error\n!z) ;\rfclose (fp);

收藏

分享

举报
下载此文档