为了账号安全,请及时绑定邮箱和手机立即绑定

c语言新手程序练习,请问下面的程序有什么问题?

c语言新手程序练习,请问下面的程序有什么问题?

C
困难00 2018-05-23 19:58:39
#include <stdio.h> struct stuu{     int num;     char name[20];     double score[3]; }; void input(struct stuu stu[],int n);//输入 void aver(struct stuu stu[],int n);//总和平均分 void big(sturct stuu stu[],int n);//最高平均分 int main() {     sturct stuu stu[5];          input(stu,5);     aver(stu,5);     big(stu,5);          return 0; } void input(struct stuu stu[],int n) {     int i,j;     for(i=0;i<n;i++)     {         scanf("%d",&stu[i].num);         fflush(stdin);         gets(stu[i].name);         for(j=0;j<3;j++)         {             scanf("%lf",&stu[i].score[j]);          }                 } } void aver(struct stuu stu[],int n) {     double sum;     int i,j,k;     sum=0;     for(i=0;i<n;i++)     {         for(j=0;;j<3;j++)         {             sum=sum+stu[i].score[j];          }                }            printf("%.2lf\n",sum/15);       }      void big(struct stuu stu[],int n) {     int i,j,k; int snum=0;     double max=0; double compp[5]={0,0,0,0,0};          for(i=0;i<n;i++)     {         for(j=0;j<3;j++)         {             compp[i]=stu[i].score[j]+compp[i];          }          if(compp[i]>max)          {              max=compp[i];              snum=i;           }                      printf("%d\n",stu[snum].num);           printf("%s\n",stu[snum].name);           for(k=0;k<3;k++)           {               printf("%.2lf\n",stu[snum].score[k]);           }           printf("%.2f\n\n",compp[snum]/3); }要求:1.输入5个学生的学号,姓名,三科成绩。2.输出所有成绩的和的平均分,3.输出5个学生中平均分最高的人的学号,姓名,三科分数,平均分。自己试的时候没发现什么问题,放到acm平台结果是wrong answer。求大神指正,谢谢!
查看完整描述

1 回答

?
龙跃十二

TA贡献1条经验 获得超0个赞


你这没有代码风格啊,这样的代码是不会有人看的。麻烦你修改代码后在提问

查看完整回答
反对 回复 2018-05-23
  • 困难00
    困难00
    啊。。不好意思,直接复制过来排版乱了没注意到。。。。
  • 1 回答
  • 1 关注
  • 881 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信