全文预览

C语言经典程序

上传者:读书之乐 |  格式:pdf  |  页数:59 |  大小:4017KB

文档介绍
£ÙÚÛÜ\r.ÔÝ,Þß!àÖװ؃!Œ“\ráâ°Ø,ãä¿0ÙÁŒ“0áâ?·Ä墘´µslud”\r‘.\r1 .p?\r2 .p?\r??\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/*i nput*/\rfor(i=0;i<5;i++)\r{ printf(\n please input No. %d score: \n!i);\rprintf("stuNo:");\rs c a n f s t u [ i ] . num);\rprintf("name:");\rscanf (/s!stu[i]. name);\rsum=0;\rfor(j=0;j<3;j++)\r{ printf ("score %d. !j+1);\rscanf (“%d”, &stu [i]. score[j]);\rsum+=stu[i]. score[j];\r)\rstu[i]. avr=sum/3. 0;\r}\rfp=fopen(stud”, w)\rfor(i=0;i<5;i++)\rif (fwrite(&stu[i]æ sizeof (struct student), 1, fp)! =1)\rprintf("file write error'n");\rfclose(fp);\r)\rxy? vc99 2005-1-22 13:16 z{|}~

收藏

分享

举报
下载此文档