求助,c语言编程题不会,哪位大神帮帮忙,跪谢

歌手大奖赛:8名同学入围本届校园歌手大奖赛决赛,由6位评委打分。每位选手的最后得分为6位评委打分总合再去掉一个最高分和最低分,请编写程序,计算出冠亚季军的编号和对应的总分。

一个二维数组就可以了。然后进行数据比较

void main()
{
    int score[8][6];
    int total[8];
    int i,j,t,min,max;
    for(i=0;i<8;i++)
    {
        for(j=0;j<6;j++)
        {
            score[i][j] = rand()%10+1;
            if(j==0)
            {
                min = score[i][j];
                max = score[i][j];
                total[i] = score[i][j];
            }
            else
            {
                total[i] += score[i][j];
                if(min > score[i][j])
                    min = score[i][j];
                if(max < score[i][j])
                    max = score[i][j];
            }
        }
        total[i] -= min+max;
    }
    //
    int one = 0,two = 0,three = 0;
    for(int i=1;i<8;i++)
    {
        if(a[i] > a[one])
        {
            three = two;
            two = one;
            one = i;
        }
        else if(a[i] > a[two])
        {
            three = two;
            two = i;
        }
        else if(a[i] > a[three])
            three = i;
    }
    printf("冠军为第%d号歌手,总成绩为:%d\n",one+1,total[one]);
    printf("亚军为第%d号歌手,总成绩为:%d\n",two+1,total[two]);
    printf("季军为第%d号歌手,总成绩为:%d\n",three+1,total[three]);
}

 

代码有点错误,以下为最终版本

#include <stdlib.h>
void main()
{
	int score[8][6];
	int total[8];
	int i, j, min, max;
	for (i = 0; i<8; i++)
	{
		for (j = 0; j<6; j++)
		{
			scanf("%d",&score[i][j]);
			if (j == 0)
			{
				min = score[i][j];
				max = score[i][j];
				total[i] = score[i][j];
			}
			else
			{
				total[i] += score[i][j];
				if (min > score[i][j])
					min = score[i][j];
				if (max < score[i][j])
					max = score[i][j];
			}
		}
		total[i] -= min + max;
	}
	//
	int one = 0, two = 0, three = 0;
	for (int i = 1; i<8; i++)
	{
		if (total[i] > total[one])
		{
			three = two;
			two = one;
			one = i;
		}
		else if (total[i] > total[two])
		{
			three = two;
			two = i;
		}
		else if (total[i] > total[three])
			three = i;
	}
	printf("冠军为第%d号歌手,总成绩为:%d\n", one + 1, total[one]);
	printf("亚军为第%d号歌手,总成绩为:%d\n", two + 1, total[two]);
	printf("季军为第%d号歌手,总成绩为:%d\n", three + 1, total[three]);
}

 

这个程序如果1号选手为最高分的话,最后的输出结果有问题呀

img