我是大一学生 上C语言课 期末让写实验报告 我呕心沥血写了半天的东西计算机死活不认 老师不给力 找老师也没帮我明确找出问题。。。我只能求助网络了...#include "Stdio.h"#include "Conio.h"struct xuesheng{char mi
我是大一学生 上C语言课 期末让写实验报告 我呕心沥血写了半天的东西计算机死活不认 老师不给力 找老师也没帮我明确找出问题。。。我只能求助网络了...#include "Stdio.h"#include "Conio.h"struct xuesheng{char mingzi;int xuehao;int score1;int score2;int score3;int total;float average;};void main(){int a,b;float f=0;struct xuesheng xues[10];for(a=0;a<10;a++){b=1+a;printf("shu ru %d wei xue sheng de xin xi\n",b);xues[a]=input();}for(a=0;a<10;a++){xues[a]=average(xues[a]);}for(a=0;a<10;a++){f=f+xues[a].score1+ xues[a].score2+ xues[a].score3;}f=f/3.0;struct xuesheng xueshengmax;xueshengmax=maximum(xues[10]);printf(" score1score2score3total\n");for(a=0;a<10;a++)printf("%4d %4c %4d %4d %4d %4d %4f\n",xues[a].xuehao,xues[a].mingzi,xues[a].score1,xues[a].score2,xues[a].score3,xues[a].total,xues[a].average);printf("average=%f\n",f);printf("the highest score:%4c,score total:%4d",xueshengmax.mingzi, tal);getch(); }struct xuesheng input(){char a;struct xuesheng stu;sancf("%c",stu.mingzi);scanf("%d",stu.xuehao);scanf("%d", ore1);scanf("%d", ore2);scanf("%d", ore3); tal=0;stu.average=0;return(stu);}struct xuesheng average(struct xuesheng a){struct xuesheng b;b=a; tal= ore1+ ore2+ ore3;b.average= tal/3.0;return(b);}struct xuesheng maximum(struct xuesheng q[int y]){int a,b,c;struct xuesheng d;d=q[0];for(a=0;a
展开
全部