internal class Program
{
static int WhoIsBigger(int a, int b)
{
int bigger = 0;
if(a > b)
{
bigger = a;
}
else
{
bigger = b;
}
return bigger;
}
static float WhoIsBigger(float a, float b)
{
float bigger = 0;
if (a > b)
{
bigger = a;
}
else
{
bigger = b;
}
return bigger;
}
static double WhoIsBigger(double a, double b)
{
double bigger = 0;
if (a > b)
{
bigger = a;
}
else
{
bigger = b;
}
return bigger;
}
static float WhoIsBigger(params float[] floats)
{
float bigger = floats[0];
for (int i = 0; i < floats.Length; i++)
{
if (bigger < floats[i])
{
bigger = floats[i];
}
}
return bigger;
}
static double WhoIsBigger(params double[] doubles)
{
double bigger = doubles[0];
for (int i = 0; i < doubles.Length; i++)
{
if (bigger < doubles[i])
{
bigger = doubles[i];
}
}
return bigger;
}
static void Main(string[] args)
{
int a = 1;
int b = 2;
double d = Math.PI;
double e = Math.Sqrt(2);
float f = 34.56f;
float g = 454.54f;
float[] A_float = { 1.2f, 0.5f, 7.7f, 9.37f };
double[] A_double = { Math.PI, Math.Sqrt(2), Math.Sin(30), Math.Cos(50), Math.Tan(45) };
Console.WriteLine("{0}和{1}中{2}更大", a, b, WhoIsBigger(a, b));
Console.WriteLine("{0}和{1}中{2}更大", f, g, WhoIsBigger(f, g));
Console.WriteLine("{0}和{1}中{2}更大", d, e, WhoIsBigger(d, e));
Console.WriteLine("float数组中{0}更大", WhoIsBigger(A_float));
Console.WriteLine("double数组中{0}更大", WhoIsBigger(A_double));
}
}