zoukankan      html  css  js  c++  java
  • 下午写的一个代码,还没调试

    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace ConsoleApplication1
    {

        class Program
        {

            static int MaxValue(int[] intArray)
            {
                int maxVal = intArray[0];
                for (int i = 1; i < intArray.Length; i++)
                {
                    if (intArray[i] > maxVal)
                        maxVal = intArray[i];
                }
                return maxVal;
            }

            static void Main(string[] args)
            {
                //int[] myArray = {1,23,45,34,53,52,64,111};
                //int maxVal = MaxValue(myArray);
                //Console.Write("数组中的最大值是:{0}",maxVal);
                //Console.ReadKey();

                int[] myArray ={0,0,0,0,0 };
                int i=0;

                do
                {
                Console.Write("请输入N个数据,用逗号隔开!");
                myArray[i] = Convert.ToInt32(Console.ReadLine());
                i++;
                }while(Console.ReadLine().ToString() != "e");

                int max =MaxValue(myArray);

             //   max(a,b);
                Console.WriteLine("你输入的最大值是:{0}", max);
                Console.ReadKey();
            }
        }
    }

  • 相关阅读:
    3.2 线程复用:线程池
    3.1.7 线程阻塞工具类:LockSupport
    3.1.6 循环栅栏:CyclicBarrier
    3.1.4 读写锁
    3.1.5 倒计时器:CountDownLatch
    3.1.3 允许多个线程同时访问:信号量
    3.1.2 condition 条件
    3.1.1 重入锁 以及源码分析
    2.8.4 错误的加锁
    jsp中 scope="application" 表示
  • 原文地址:https://www.cnblogs.com/gfwei/p/524470.html
Copyright © 2011-2022 走看看