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());

                }
            }
        }
    }

  • 相关阅读:
    [Leetcode] ZigZag Conversion
    [Leetcode] Wildcard Matching
    [Leetcode] 4Sum
    [Leetcode] Word Break II
    [Leetcode] Best Time to Buy and Sell Stock III
    [Leetcode] Permutation Sequence
    [Leetcode] Surrounded Regions
    [Jobdu] 题目1522:包含min函数的栈
    CUDA2.1-原理之索引与warp
    opencv8-GPU之相似性计算
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4423714.html
Copyright © 2011-2022 走看看