static void Main(string[] args)
{
ArrayList al = new ArrayList();
Console.Write("请输入人数");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < n; i++)
{
Console.Write("请输入第" + (i + 1) + "个人的分数");
int fenshu = Convert.ToInt32(Console .ReadLine ());//分数代入
al.Add(fenshu);//把分数放在al这个集合里
}
double sum = 0;
for (int b = 0; b < n; b++) //分数 的下标
{
sum = sum + (double)al[b];//a[b]是一个集合类型的,而 sum是double类型的,所以要把al[]b]强制转换成double类型的
}
double avg = sum / n;
Console.WriteLine("总分为" + sum);
Console.WriteLine("平均分" + avg);
al.Sort();
al.Reverse();
for (int d = 0; d < n; d++)
{
Console.WriteLine(al[d]);
}
Console.ReadLine();