#include<stdio.h>
void fun1(float (*p)[5])
{
int i,j;
float sum=0,ave;
for(i=0;i<4;i++)
sum+=*(*(p+i)+0);
ave=sum/4;
printf("The average of studene Court1 is:%.1f\n",ave);
}
void fun2(float (*p)[5])
{
int i,j,k;
float sum,ave;
for(i=0;i<4;i++)
{
sum=0;
k=0;
for(j=0;j<5;j++)
if(*(*(p+i)+j)<60)
k++;
if(k>=2)
{
printf("Student No.%d\t",i+1);
for(j=0;j<5;j++)
printf("%.1f\t",*(*(p+i)+j));
for(j=0;j<5;j++)
sum+=*(*(p+i)+j);
ave=sum/5;
printf("average:%.1f\n",ave);
}
}
}
void fun3(float (*p)[5])
{
int i,j,k;
float sum,ave;
for(i=0;i<4;i++)
{
sum=0;
k=0;
for(j=0;j<5;j++)
{
sum+=p[i][j];
if(p[i][j]>85)
k++;
}
ave=sum/5;
if(k==5||ave>90)
{
printf("Student No.%d\t",i+1);
for(j=0;j<5;j++)
printf("%.1f\t",p[i][j]);
printf("average:%.1f\n");
}
}
}
int main()
{
float score[4][5];
int i,j;
for(i=0;i<4;i++)
{
printf("please input 5 scores of student No.%d:",i+1);
for(j=0;j<5;j++)
scanf("%f",&score[i][j]);
}
printf("\tCourt1\tCourt2\tCourt3\tCourt4\tCourt\n");
for(i=0;i<4;i++)
{
printf("No.%d:\t",i+1);
for(j=0;j<5;j++)
printf("%.1f\t",score[i][j]);
printf("\n");
}
fun1(score);
fun2(score);
fun3(score);
return 0;
}