使用方法做要求输入第一个数字大于第二个数字
2015-05-10 15:54
190 查看
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; }
相关文章推荐
- 简单编程(一) 新手入门作业 [要求用户输入两个整数,判断第一个整数是否是第二个整数的倍数(使用运算符%)。]
- 输入两个字符串,比如abdbcc和abc,输出第二个字符串在第一个字符串中的连接次序(递归方法)
- 输入一串数字,将其中最小的与第一个调换,最大的与第二个调换,然后输出
- 输入两个字符串,比如abdbcc和abc,输出第二个字符串在第一个字符串中的连接次序(递归方法)
- 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序。假设压入栈的所有数字均不相等。
- jQuery控制文本框只能输入数字和字母及使用方法
- 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序。假设压入栈的所有数字均不相等。例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序列对应的一
- 在网页里让文本框只能输入数字的一种方法。外加回车换Tab (javascript key键的使用)+禁止切换输入法---转
- 解决“Visual Studio 要求设计器使用文件中的第一个类。移动类代码使之成为文件中的第一个类,然后尝试重新加载设计器。”方法
- 在网页里让文本框只能输入数字的一种方法。外加回车换Tab (javascript key键的使用)+禁止切换输入法
- 解决“Visual Studio 要求设计器使用文件中的第一个类。移动类代码使之成为文件中的第一个类,然后尝试重新加载设计器。”方法
- [VB.NET]要求文本框中只能输入数字的方法总结.
- [VB.NET]如何在第二个窗体里使用第一个窗体的控件方法
- 解决“Visual Studio 要求设计器使用文件中的第一个类。移动类代码使之成为文件中的第一个类,然后尝试重新加载设计器。”方法
- java--封装一类Java对象,用户从输入对话框输入两个日期,程序将判断两个日期的大小关系(比如输出:您输入的第二个日期大于第一个日期)以及两个日期之间的间隔天数(比如输出:2006年6月6日和
- 输入一个大于1的正整数N,求1+2+。。。+N 要求是不能使用乘除法,for,while,if,else,switch,case等关键字以及A?B:C
- 解析使用js判断只能输入数字、字母等验证的方法(总结)
- 解析使用js判断只能输入数字、字母等验证的方法(总结)
- 输入两个字符串,比如abdbcc和abc,输出第二个字符串在第一个字符串中的连接次序(递归方法)
- 华为机试题:输入两个超长整型构成的字符串,其间使用一个空格分隔,每个字符串最大长度为100个字符。求第一个整数除以第二个整数以后的余数。。