全文预览

C经典百题

上传者:非学无以广才 |  格式:pdf  |  页数:58 |  大小:5542KB

文档介绍
ning : The document was created with Spire.PDF for .NET.\rfclose(fp);\rW  100«\rXY`•¬q­®0¯q­®•3 °±c†²0ijklmxe³(´µ­®¶0·¸0\r¹°±†²)0Z[aº»†²0¼½•ce³˜Z[acº»@eŽ›¾wkŠ‹stud\r_}\rL @P`\r2 .\n`\rttinclude "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 (i=0;i<5;i++)\r{ printf (0z\n please input No. %d score: \n \ i);\rprintfCstuNo:");\rscanf (gs0stu[i]. num);\rprintf("name:)<\rscanf (z0%s0z, stu[i]. name);\rsum=0;\rfor(j=0;j<3;j++)\r{ printf (z0score %d. 0j+1);\rscanf (%d, &stu[i]. score[j]);\rsum+=stu[i]. score[j];\r)\rstu[i]. avr=sum/3. 0;\r)\rfp=fopen(stud0w)<\rfor (i=0;i<5;i++)\rif (fwrite(&stu[i], sizeof(struct student),1,fp)!=1)\rprintf (z0file write error\r)/z) ;\rfclose(fp);

收藏

分享

举报
下载此文档