首页 > 其他 > 详细

使用方法做要求输入第一个数字大于第二个数字

时间:2015-05-10 17:04:28      阅读:193      评论:0      收藏:0      [点我收藏+]
       static void Main(string[] arr)
        {
            int[] shuZi;
            
            bool bj = false;
            while (!bj)
            {
                shuZi = Test();
                bj = BiJiao(shuZi[0], shuZi[1]);
                  }
            Console.WriteLine("ok");
            Console.ReadKey();
        }

        public static int[] Test()
        {
            int n1=0;
            int n2=0;
            try
            {
                Console.WriteLine("请输入数字1");
                n1 = ZhuanHuan();
                Console.WriteLine("请输入数字2");
                n2 = ZhuanHuan();

            }
            catch
            {
                Console.WriteLine("请输入正确的数字");
                Test();
            }
            int[] intSz=new int[2];
            intSz[0]=n1;
            intSz[1]=n2;
            return intSz;
            
        }
        public static int ZhuanHuan()
        {
            int numbers = Convert.ToInt32(Console.ReadLine());
            return numbers;
        }

        public static bool BiJiao(int n1, int n2)
        { 
            bool bj=false;
            if (n1 > n2)
            {
                bj = true;
            }
            return bj;
        }

 

使用方法做要求输入第一个数字大于第二个数字

原文:http://www.cnblogs.com/zywf/p/4492344.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!