VS2005 控制台程序运行时 ,DOS界面为什么一闪而过?
我的程序如下:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceCompare{...
我的程序如下:
using System;
using System.Collections.Generic;
using System.Text;
namespace Compare
{
class Program
{
public int Compare(int max, int min)
{
int t;
if (max < min)
{
t = min;
min = max;
max = t;
}
return max;
}
public double Compare(double max, double min)
{
double t;
if (max - min < 0.0001)
{
t = min;
min = max;
max = t;
}
return max;
}
public string Compare(string max, string min)
{
if (max.Length < min.Length)
{
return min;
}
return max;
}
static void Main(string[] args)
{
Program max = new Program();
Console.WriteLine("比较两个整数,请输入两个整数");
int num1 = int.Parse(Console.ReadLine());
int num2 = int.Parse(Console.ReadLine());
Console.WriteLine("大数: {0}", max.Compare(num1, num2));
Console.WriteLine("比较两个小数,请输入两个小数");
double No1 = double.Parse(Console.ReadLine());
double No2 = double.Parse(Console.ReadLine());
Console.WriteLine("大数: {0}", max.Compare(No1, No2));
Console.WriteLine("比较两个string,请输入两个小数");
string Sring1 = string.Parse(Console.ReadLine());
string Sring = string.Parse(Console.ReadLine());
Console.WriteLine("大数: {0}", max.Compare(Sring1, String2));
}
}
} 展开
using System;
using System.Collections.Generic;
using System.Text;
namespace Compare
{
class Program
{
public int Compare(int max, int min)
{
int t;
if (max < min)
{
t = min;
min = max;
max = t;
}
return max;
}
public double Compare(double max, double min)
{
double t;
if (max - min < 0.0001)
{
t = min;
min = max;
max = t;
}
return max;
}
public string Compare(string max, string min)
{
if (max.Length < min.Length)
{
return min;
}
return max;
}
static void Main(string[] args)
{
Program max = new Program();
Console.WriteLine("比较两个整数,请输入两个整数");
int num1 = int.Parse(Console.ReadLine());
int num2 = int.Parse(Console.ReadLine());
Console.WriteLine("大数: {0}", max.Compare(num1, num2));
Console.WriteLine("比较两个小数,请输入两个小数");
double No1 = double.Parse(Console.ReadLine());
double No2 = double.Parse(Console.ReadLine());
Console.WriteLine("大数: {0}", max.Compare(No1, No2));
Console.WriteLine("比较两个string,请输入两个小数");
string Sring1 = string.Parse(Console.ReadLine());
string Sring = string.Parse(Console.ReadLine());
Console.WriteLine("大数: {0}", max.Compare(Sring1, String2));
}
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询