首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

求看下小弟我打的程序,提交时wrong answer,求AC。

2013-12-06 
求看下我打的程序,提交时wrong answer,求AC。。。有一个班4个学生,5门课。①求第一门课的平均分②找出有2门以上

求看下我打的程序,提交时wrong answer,求AC。。。
有一个班4个学生,5门课。①求第一门课的平均分;②找出有2门以上课程不及格的学生,输出他们的学号和全部课程成绩和平均成绩;③找出平均成绩在90分以上或全部课程成绩在85分以上的学生。分别编3个函数实现以上3个要求。


input sample
43 77 97 58 84 1
78 58 65 93 60 2
88 89 96 100 86 3
80 34 78 55 83 4

output sample求看下小弟我打的程序,提交时wrong answer,求AC。

我自己打的代码
#include<stdio.h>
float score[4][6];
void average1 (float *pointer1);
void fail(float *pointer2);
void great(float *pointer3);
int main()
{
int i,j;
float *p;
for(i=0;i<4;i++)
{  
  for(j=0;j<6;j++)  
  scanf("%f",&score[i][j]);
}
p=&score[0][0];
average1(p);
fail(p);
great(p);
  return 0;
  }
  
void average1(float *pointer1)
{int i;
double s=0.00,ave1;
for(i=0;i<4;i++)
{
s=*pointer1+s;
pointer1+=6;} 
ave1=s/4.0;  
 printf("The average score of course 1 is%.2lf\n\n",ave1);
}
void fail(float *pointer2)
{
 int i,j,k;
double s=0.00,t;
 for(i=0;i<4;i++)
{  k=0;s=0;
   for(j=0;j<5;j++)  
 {
 if(score[i][j]<60)
 k++;
   }
    
   if(k>=2)
{printf("The student number is: %d\n",i+1);
 printf("The student's every course score are:");
 for(j=0;j<5;j++)
 printf("%.2f,",score[i][j]);
 printf("\n");
 for(j=0;j<5;j++)
 {s=s+score[i][j];
 t=s/5.0;}
 printf("The student's average score is:%.2lf\n",t);
}
}
 
}

void great(float *pointer3)
{
int i,j,k;
double s,t;
for(i=0;i<4;i++)
{s=0.00;
for(j=0;j<5;j++)
{  s=s+score[i][j];
  t=s/5.0;}
if(t>=90)
printf("student %d average score is above 90\n",i+1);
}
for(i=0;i<4;i++)
{k=0;
for(j=0;j<5;j++)
{if(score[i][j]>=85)
k++;}
if(k==5)
{printf("student %d every score is above 85\n",i+1);}
}
printf("\n");
}


我的运行结果
求看下小弟我打的程序,提交时wrong answer,求AC。


提交时候显示的是wrong answer、、


问下有什么解决方案吗~~~求救~~~

[解决办法]
The average score of course 1 is:72.25

热点排行