美文网首页
第十二节课的第二个作业

第十二节课的第二个作业

作者: zjh666 | 来源:发表于2018-12-06 20:11 被阅读0次

#编码

try

            {

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

                int[] nums = new int[6];

                for(int i = 0; i<nums.Length;i++)

                {

                    Console.WriteLine("请输入第{0}个数字:", i + 1);

                    string str_a = Console.ReadLine();

                    nums[i] = Convert.ToInt32(str_a);

                }

                Array.Sort(nums);

                Array.Reverse(nums); // 排序

                Console.WriteLine("排序后的成绩为:");

                for(int i = 0; i<nums.Length; i++)

                {

                    Console.Write("{0}\t", nums[i]);

                }

            }

            catch

            {

                Console.WriteLine("你输入的格式有误,程序退出");

            }

            Console.ReadKey();

#效果

相关文章

网友评论

      本文标题:第十二节课的第二个作业

      本文链接:https://www.haomeiwen.com/subject/tglacqtx.html