全文预览

c语言例子1

上传者:梦&殇 |  格式:pdf  |  页数:59 |  大小:4874KB

文档介绍
;\r)\rfclose(fp);\r)\r;, - 100Ú\r<=:' ?¦Û@u?¦Û'3 ÜÝ?Þ,³´µ¶Œ"B‚(àá¦Ûâ@ãä@ÜÝ\rÞ),¯°x\råæÞ@ç#'?B‚\¯°x?åæBÉ΃¼µÆÇ“ stud”.\r1 .,-./\r2 .,-012/\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("\n please input No. %d score:\n",i);\rprintf(^'stuNo:^,);\rscanf(n%sn,stu[i].num);.\rprintf('^name:,');\rscanf("%s",stu[i].name);\rsum=O;\rfor(j=0;j<3;j++)\r{ printf(Mscore %d.",j+l);\rscanf(,,%dH,&stu[i].score[j]);\rsum+=stu[i].score|j];\r)\rstufi].avr=sum/3.0;\r)\rfp=fopen("stud","w");\rfor(i=0;i<5;i++)\rif(fwrite(&stufi],sizeof(struct student), 1 ,fp)!=1)\rprintf("file write error\nH);\rfclose(fp);

收藏

分享

举报
下载此文档