第十二节课的一个作业

第十二节课的一个作业_第1张图片
图片发自App


try

            {

                Console.WriteLine("请输入一个数字");

                string str_i = Console.ReadLine();

                int i = Convert.ToInt32(str_i);

                if (i > 0 && i < 100)

                {

                    ArrayList a = new ArrayList();

                    a.Add(i);

                    ArrayList score = new ArrayList(6);

                    score.Add(99);

                    score.Add(85);

                    score.Add(82);

                    score.Add(63);

                    score.Add(60);

                    score.InsertRange(0, a);

                    score.Sort(0, 6, null);

                    foreach (var b in score)

                    {

                        Console.Write(b + "\t");

                    }

                }

                else

                {

                    Console.WriteLine("成绩在0~100之间");

                }

            }

            catch

            {

                Console.WriteLine("输入错误");

            }

            Console.ReadKey();

#效果

你可能感兴趣的:(第十二节课的一个作业)