ArrayList 练习

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace arrayLIST练习
{
    class Program
    {

        static void Main(string[] args)
        {
            ArrayList A = new ArrayList();
            Console.WriteLine("请输入人数:");
            int B = int.Parse(Console.ReadLine());
            for (int C = 0; C < B; C++)
            {
                Console.WriteLine("请输第" + C + 1 + "个人数的成绩:");
                A.Add(int.Parse(Console.ReadLine()));
            }


            double SUM = 0;

            for (int Z = 0; Z < B; Z++)
            {
                SUM += double.Parse(A[Z].ToString());
            }
            double AVE = SUM / B;
            Console.WriteLine("平均分数:" + AVE);


            A.Sort();
            for (int c = 0; c < B; c++)
            {
                Console.WriteLine(A[c]);
               
            }
         
            Console.ReadLine();
        }

    }
}

  

posted @ 2015-08-12 23:20  人走茶亦凉  阅读(322)  评论(0编辑  收藏  举报