全文预览

c语言百例

上传者:火锅鸡 |  格式:pdf  |  页数:74 |  大小:4524KB

文档介绍
uƒÙP uƒÙÆ3 ÚÛ¼ÜP¦§¨©ª?@Ý(Þ߃ÙàPá\râP ÚÛ¼Ü)P™šŸ\rãä¼ÜPåæÆ@Ý?™šŸãä&@ÂÉ粨¾¿GstudG!\r1 .$%&'\r2 .$%)*\r#include "stdio. hG\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 (Pz\n please input no. %d score:\nGPi);\rprintf("stuno:G)_\rscanf (Pz%sPz, stu[i]. num);.\rprintf (z/namezP) ;\rscanf (G¢s?pstu[i]. name);\rsum=O;\rfor(j=0;j<3;j++)\r{ printf ('"score %d. ?pj+1);\rscanf &stu[i]. score[j]);\rsum+=stu[i]. score]j];\r)\rstu[i]. avr=sum/3. 0;\r)\rfp=fopen(P/stud,P, GwG);\rfor(i=0;i<5;i++)\rif (fwrite(&stu[i], sizeof(struct student), 1, fp)!=1)\rprintf (^file write error\nzP) ;\rfclose(fp);\r)

收藏

分享

举报
下载此文档