您的位置:首页 > 其它

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

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐