疑惑中二维数组加自定义函数

问题遇到的现象和发生背景

练习二维数组代码

遇到的现象和发生背景,请写出第一个错误信息

运行无法继续,

用代码块功能插入代码,请勿粘贴截图。 不用代码块回答率下降 50%
#include <stdio.h>
#include <stdlib.h>
#define Course 6
#define Student 4
void MaxScore(double e[][Course])
{
    int temp, row, col, shift;
    for (col = 0; col < Course; col++)
    {
        for (shift = 0; shift <= Student - 2; shift++)
        {
            for (row = 0; row <= Student - shift - 2; col++)
            {
                if (e[row][Course] >e[row + 1][Course])
                {
                    temp = e[row][Course];

                    e[row][Course] = e[row + 1][Course];
                    e[row + 1][Course] = temp;
                }
            }
        }
        printf("\n科目%d的最高分为%d\n", col, e[Student - 1][col]);
    }
}
int main()
{
    int col, row;
    double score[Student][Course];
    for (row = 0; row < Student; row++)
    {
        for (col = 0; col < Course; col++)
            scanf("%lf", &score[row][col]);
    }
    MaxScore(score);
    system("pause");
    return 0;
}


运行结果及详细报错内容

输入4行6列后运行窗不运行,无法继续输入,但不运行

我的解答思路和尝试过的方法,不写自己思路的,回答率下降 60%

我试了好几次都没找出来,仍在思考

我想要达到的结果,如果你需要快速回答,请尝试 “付费悬赏”

希望大能能在百忙中帮忙扫一眼,不胜感激

  • 你 maxScore 里的处理有问题,按你的 排序思路改了一下:

img

参考如下:

void MaxScore(double e[][Course])
{
    int temp, row, col;
    for (col = 0; col < Course; col++)
    {
        for (row = 0; row < Student - 1; row++)
        {
            if (e[row][col] > e[row + 1][col])
            {
                temp = e[row][col];
                e[row][col] = e[row + 1][col];
                e[row + 1][col] = temp;
            }
        }
        printf("\n科目%d的最高分为%lf\n", col + 1, e[Student - 1][col]);
    }
}

如有帮助,欢迎点赞+采纳哈!

for (row = 0; row <= Student - shift - 2; col++)
最后一个是row++