C# Перегрузить функцию min(), при помощи которой будет находиться минимальное число среди: а) трех целых чисел; б) трех символов; в) четырех дробных чисел.
using System; class Program { static int mininta,intb,intcint a, int b, int cinta,intb,intc
{ int minValue = a; if (b < minValue) { minValue = b; } if (c < minValue) { minValue = c; } return minValue; } static void Main
{ int result = min10,5,2010, 5, 2010,5,20; Console.WriteLineresultresultresult; // Выводит наименьшее число } }
б)
using System; class Program { static char minchara,charb,charcchar a, char b, char cchara,charb,charc
{ char minValue = a; if (b < minValue) { minValue = b; } if (c < minValue) { minValue = c; } return minValue; } static void Main
{ char result = min′a′,′b′,′c′'a', 'b', 'c'′a′,′b′,′c′; Console.WriteLineresultresultresult; // Выводит наименьший символ } }
в)
using System; class Program { static double mindoublea,doubleb,doublec,doubleddouble a, double b, double c, double ddoublea,doubleb,doublec,doubled
{ double minValue = a; if (b < minValue) { minValue = b; } if (c < minValue) { minValue = c; } if (d < minValue) { minValue = d; } return minValue; } static void Main
{ double result = min2.5,1.3,4.7,3.22.5, 1.3, 4.7, 3.22.5,1.3,4.7,3.2; Console.WriteLineresultresultresult; // Выводит наименьшее дробное число } }
а)
using System;class Program
{
static int mininta,intb,intcint a, int b, int cinta,intb,intc {
int minValue = a;
if (b < minValue)
{
minValue = b;
}
if (c < minValue)
{
minValue = c;
}
return minValue;
}
static void Main {
int result = min10,5,2010, 5, 2010,5,20;
Console.WriteLineresultresultresult; // Выводит наименьшее число
}
}
б)
using System;class Program
{
static char minchara,charb,charcchar a, char b, char cchara,charb,charc {
char minValue = a;
if (b < minValue)
{
minValue = b;
}
if (c < minValue)
{
minValue = c;
}
return minValue;
}
static void Main {
char result = min′a′,′b′,′c′'a', 'b', 'c'′a′,′b′,′c′;
Console.WriteLineresultresultresult; // Выводит наименьший символ
}
}
в)
using System;class Program
{
static double mindoublea,doubleb,doublec,doubleddouble a, double b, double c, double ddoublea,doubleb,doublec,doubled {
double minValue = a;
if (b < minValue)
{
minValue = b;
}
if (c < minValue)
{
minValue = c;
}
if (d < minValue)
{
minValue = d;
}
return minValue;
}
static void Main {
double result = min2.5,1.3,4.7,3.22.5, 1.3, 4.7, 3.22.5,1.3,4.7,3.2;
Console.WriteLineresultresultresult; // Выводит наименьшее дробное число
}
}