zoukankan      html  css  js  c++  java
  • 函数 青歌赛打分

    namespace 函数__青歌赛打分
    {
        class Program
        {
            public int[] Array(int[] a)   //排序
            {
                int n = a.Length;
                for (int i = 1; i <= a.Length; i++)
                {
                    for (int j = 1; j <= a.Length-i; j++)
                    {
                        int temp = 0;
                        if(a[j-1]<a[j])
                        {
                            temp = a[j - 1];
                            a[j - 1] = a[j];
                            a[j] = temp;
                        }
                    }
                }
                return a;  //返回一个int[]类型的a,用来给下面使用
            }


            static void Main(string[] args)
            {
                Console.WriteLine(" ***********下面请评委开始打分***********");
                int[] pingweidafen=new int[5];
                //输入  (右键点击——重构——提取方法——输入方法名称)
                ShuRu(pingweidafen);  
                //排序
                int[] b= new Program().Array(pingweidafen);
                //输出
                ShuChu(b);
                Console.ReadLine();
            }

            private static void ShuChu(int[] b)  //输出结果
            {
                for (int i = 0; i < 5; i++)
                {
                    Console.WriteLine(b[i]);
                }

            }

            private static void ShuRu(int[] pingweidafen)  //输入评委打的分数
            {
                for (int i = 0; i < 5; i++)
                {
                    Console.WriteLine("请第" + (i + 1) + "位评委亮分:");
                    pingweidafen[i] = Convert.ToInt32(Console.ReadLine());

                }
            }
        }
    }

  • 相关阅读:
    征集“微软武汉DOTNET俱乐部武汉大学樱花赏”活动内容
    2007上半年微软武汉.NET俱乐部活动预告。
    [微软新技术培训]微软新技术预览之Microsoft Office SharePoint Server 2007
    武汉.NET俱乐部武大赏樱花精彩图片
    [微软新技术培训]微软新技术预览之Visual Studio Team System
    [摘]互联网传说
    python:注释最多的冒泡排序
    《C#线程参考手册》读书笔记(一):定义线程
    【转】C# DateTime 日期计算
    详谈WPF开发中的数据虚拟化
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4423714.html
Copyright © 2011-2022 走看看