这是我编的。不知道行不行?
#include"stdio.h"
int main()
{
int score[5][7], sum[5], sun[7];
int i, j, m = 1, n = 1, max, min, sim = 0, sin = 0;
int xue[5];
for (i = 1; i < 5; i++)
{
printf("请输入第%d个学生的学号及六次成绩\n", i);
scanf("%d", &xue[i]);
for (j = 1; j < 7; j++)
scanf("%d", &score[i][j]);
}
for (i = 1; i < 5; i++)
{
for (j = 1; j < 7; j++)
sim = sim + score[i][j];
sum[i] = sim;
sim = 0;
}
for (i = 1; i < 7; i++)
{
for (j = 1; j < 5; j++)
sin = sin + score[j][i];
sun[i] = sin;
sin = 0;
}
max = sum[1];
min = sum[1];
for (i = 1; i < 5; i++)
{
if (sum[i] > max)
{
max = sum[i];
m = i;
}
}
for (i = 1; i < 5; i++)
{
if (sum[i] < min)
{
min = sum[i];
n = i;
}
}
printf("总分最高学生为%d\n总分最低学生为%d\n", xue[m],
xue[n]);
printf("请输入学生学号\n");
scanf("%d", &m);
for (i = 1; i < 5; i++)
{
if (m == xue[i])
{
for (j = 1; j < 7; j++)
printf("该生第%d次考试成绩为%d\n", j, score[i][j]);
printf("该生平均成绩为%f\n", (float)sum[i] / 6);
}
}
printf("请输入考试考试次数\n");
scanf("%d", &n);
for (i = 1; i < 5; i++)
{
printf("学号为%d", xue[i]);
printf("成绩为%d\n", score[i][n]);
}
printf("该次平均成绩为%f", (float)sun[n] / 4);
return 0;
}
改错的话很好改。楼主自己加个if else吧!!!