Synchronization of old projects

Part1
This commit is contained in:
2025-09-30 16:46:01 +08:00
parent 116b65164b
commit 4e1548abe2
167 changed files with 8668 additions and 43 deletions
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -0,0 +1,91 @@
using System;
namespace Lesson
{
class Program
{
static int Compare(int a, int b)
{
if (a > b)
{
return a;
}
else
{
return b;
}
}
static float Compare(float a, float b)
{
if (a > b)
{
return a;
}
else
{
return b;
}
}
static double Compare(double a, double b)
{
if (a > b)
{
return a;
}
else
{
return b;
}
}
static int CompareInf(params int[] a)
{
int max = 0;
for (int i = 0; i < a.Length; i++)
{
if (a[i] > max)
{
max = a[i];
}
}
return max;
}
static float CompareInf(params float[] a)
{
float max = 0.0f;
for (int i = 0; i < a.Length; i++)
{
if (a[i] > max)
{
max = a[i];
}
}
return max;
}
static double CompareInf(params double[] a)
{
double max = 0.0d;
for (int i = 0; i < a.Length; i++)
{
if (a[i] > max)
{
max = a[i];
}
}
return max;
}
static void Main(string[] args)
{
Console.WriteLine(Compare(1, 2));
Console.WriteLine(Compare(2.1f, 3.2f));
Console.WriteLine(Compare(3.675475d, 4.6435432d));
Console.WriteLine(CompareInf(1,2,3,4,5,6,7));
Console.WriteLine(CompareInf(1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f));
Console.WriteLine(CompareInf(1.1d, 1.2d, 1.3d, 1.4d, 1.5d, 1.6d, 1.7d));
}
}
}