C语言新手,求大神指导
# include <stdio.h>double average(int, int, int, int);
void check(int (*)[],char(*)[]);
void check1(int (*)[], char(*)[]);
void main()
{
printf("input the name and grades :\n");
char name[4][10];
int grades[4][5];
int (*p)[5] = grades;
char(*t)[10] = name;
for (int i = 0; i < 4; i++)
{
scanf("%s", *(name + i));
for (int j = 0; j < 4; j++)
scanf("%d", *(grades + i) + j);
}
printf("the chart is:\n");
for (int i = 0; i < 1; i++)
{
printf("%s ", *(name + i));
for (int j = 0; j < 4; j++)
printf("%d ", *(*(grades + i) + j));
printf("\n");
}
double a;
a = average(grades[0][0], grades[1][0], grades[2][0], grades[3][0]);
printf("the average grades is: %.2lf\n", a);
check(p,t);
check1(p, t);
return 0;
}
double average(int a, int b, int c, int d)
{
double e;
e = (a + b + c + d) / 4;
return e;
}
void check(int (*p)[5],char (*t)[10])
{
int i;
int num=0;
printf("the unqualified students are :\n");
for (i = 0; i < 4; i++)
{
num = 0;
for (int j = 0; j < 5; j++)
{
if (*(*(p + i) + j) < 60)
num++;
if (num == 2)
{
printf("%s : ", *(t + i));
printf("%d %d %d %d ", *(*(p + i)), *(*(p + i) + 1), *(*(p + i) + 2), *(*(p + i) + 3));
printf("average : %.2lf ", average(*(*(p + i)), *(*(p + i) + 1), *(*(p + i) + 2), *(*(p + i) + 3)));
printf("\n");
}
}
}
}
void check1(int (*p)[5], char(*t)[10])
{
int i, j;
double b = 0;
printf("the great students are:\n");
for (i = 0; i < 4; i++)
{
b = average(*(*(p + i)), *(*(p + i) + 1), *(*(p + i) + 2), *(*(p + i) + 3), *(*(p + i) + 4));
if (b >= 90)
printf("%s ", *(t + i));
if (b<90 && *(*(p + i)) >= 85 && *(*(p + i) + 1) >= 85 && *(*(p + i) + 2) >= 85 && *(*(p + i) + 3) >= 85 && *(*(p + i) + 4) >= 85)
printf("%s ", *(t + i));
}
}
写了这个程序,前面都没有错,但是后面if (b<90 && *(*(p + i)) >= 85 && *(*(p + i) + 1) >= 85 && *(*(p + i) + 2) >= 85 && *(*(p + i) + 3) >= 85 && *(*(p + i) + 4) >= 85),这一段没办法判别.本段语句我想实现的是,单输入的数值都大于85时,输出该同学名字.请问为什么实现???