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

                }
            }
        }
    }

  • 相关阅读:
    关于 Kubernetes 中的 Volume 与 GlusterFS 分布式存储
    使用 Kubeadm 升级 Kubernetes 版本
    Kubernetes 中的核心组件与基本对象概述
    使用 Kubeadm 安装部署 Kubernetes 1.12.1 集群
    比较 Spring AOP 与 AspectJ
    关于 Spring Security OAuth2 中 CORS 跨域问题
    Prometheus 入门与实践
    MySQL 分支的选择:Percona 还是 MariaDB
    Spring Boot 集成 Swagger2 与配置 OAuth2.0 授权
    关于 Spring Security 5 默认使用 Password Hash 算法
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4423714.html
Copyright © 2011-2022 走看看