查找有一门以上课程不及格的学生,输出他们的全部成绩

#include
int main()
{
float average(float *p,int n);
    float search(float (*b)[4],int n);
void sear(float(*c)[4],int n);
float score[3][4]={65,57,70,60,80,87,50,81,90,99,100,98};
printf("%5.2f\n",average(*score,12));
printf("%5.2f\n",search(score,2));
sear(score,3);
return 0;


}
float average(float *p,int n)
{
float *a,aver,sum=0;
for(a=p;a sum=sum+*a;
aver=sum/n;
return(aver);
}
float search(float (*b)[4],int n)
{
float sum=0;
int j;
for(j=0;j<4;j++)
sum=sum+*(*(b+n)+j);
return(sum);
}
void sear(float(*p)[4],int n)
{
int i,j,flag;
for(j=0;j {
flag=0;
for(i=0;i<4;i++)
if(*(*(p+j)+i)<60) flag=1;
if(flag==1)
{
printf("NO.%d fails,his scores are:\n",j+1);
for(i=0;i<4;i++)
printf("%5.1f",*(*(p+j)+i));
printf("\n");
}
}
}








你可能感兴趣的:(C语言基础学习)