全文预览

经典c程序例题

上传者:业精于勤 |  格式:pdf  |  页数:63 |  大小:5294KB

文档介绍
ion Warning : The document was created with Spire.PDF for .NET.\rL100‘\rOPx’“”\n•“”x3 –—j^˜\nQRp\rk?™š(›œ“”\nžŸ\n–\r—^˜ )\n¡¢b£¤^˜\r¥xj™š{¡¢bj£¤™i~¦`pcd+ stud +g\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 (i=0;i<5;i++)\r{ printf (/z\n please input No. %d score:\n+\ni);\rprintf ("stuNo: +);\rscanf (+%s+\nstu[i]. num);\rprintf(+name:+)7\rscanf (+%s+\nstu[i]. name);\rsum=0;\rfor(j=0;j<3;j++)\r{ prinlf ("score %d. +\nj+1);\rscanf (\n%d/z, &stu[i]. score[j]);\rsum+=stu[i].score[j];\r}\rstu[i]. avr=sum/3. 0;\r}\rfpwfopen(+stud+, +w+);\rfor(i=0;i<5;i++)\rif (fwrite(&stu[i], sizeof(struct student), 1, fp)!=1)\rprintf (vfile write error\n/z);\rfclose(fp);

收藏

分享

举报
下载此文档