用集合代替数组:
Console.Write("请输入人数:");
int renshu = int.Parse(Console.ReadLine());
ArrayList chengji = new ArrayList();
if (renshu >= )
{
for (int h = ; h <= renshu; h++)
{
Console.Write("请输入第" + h + "个人成绩");
chengji.Add(int.Parse(Console.ReadLine()));
}
chengji.Sort();
foreach (int a in chengji)
{
Console.Write(a+" ");
} int he = ;
for (int i = ; i <= renshu - ; i++)
{
he = he + (int)chengji[i];
}
double pj = (he - (int)chengji[] - (int)chengji[] - (int)chengji[renshu - ] -(int)chengji[renshu - ] / (renshu - ));
Console.Write("去掉两个最低分"+chengji[]+","+chengji[]+"去掉两个最高分"+chengji[renshu - ]+","+chengji[renshu - ]+"最后的成绩是:"+pj); }
else
{
Console.WriteLine("您输入的人数要大于等于5!!!");
}
Console.ReadLine();
foreach查询多为数组:
???