Archived
1
0
This commit is contained in:
2025-11-01 08:20:49 +08:00
parent e0fbc20716
commit 6151e4f8c9
29 changed files with 1010 additions and 3 deletions

11
cs5/5_1/5_1.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_5_1</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
cs5/5_1/5_1.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5_1", "5_1.csproj", "{82D15861-AC86-4C64-8477-2687C2846721}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{82D15861-AC86-4C64-8477-2687C2846721}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{82D15861-AC86-4C64-8477-2687C2846721}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82D15861-AC86-4C64-8477-2687C2846721}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82D15861-AC86-4C64-8477-2687C2846721}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {65D009ED-CB3D-43A5-98F3-0FD1FFFBF78E}
EndGlobalSection
EndGlobal

34
cs5/5_1/Program.cs Normal file
View File

@@ -0,0 +1,34 @@
using System;
namespace _5_1
{
class MyMath
{
public const double PI = 3.1415926;
public static double perimeter(double r)
{
double p = 2 * PI * r;
return p;
}
public static double area(double r)
{
double a = PI * r * r;
return a;
}
public static double volume(double r)
{
double v = (4.0 / 3) * PI * r * r * r;
return v;
}
public class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入半径:\n");
double r = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("圆的周长为:{0}\n", MyMath.perimeter(r));
Console.WriteLine("圆的面积为:{0}\n", MyMath.area(r));
Console.WriteLine("球的体积为:{0}\n", MyMath.volume(r));
}
}
}
}

11
cs5/5_2/5_2.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_5_2</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
cs5/5_2/5_2.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5_2", "5_2.csproj", "{24FDF2F6-69DD-4F6F-A667-8EE25A8F65D8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{24FDF2F6-69DD-4F6F-A667-8EE25A8F65D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24FDF2F6-69DD-4F6F-A667-8EE25A8F65D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24FDF2F6-69DD-4F6F-A667-8EE25A8F65D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24FDF2F6-69DD-4F6F-A667-8EE25A8F65D8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0F9A79BA-C7F0-4698-B7CC-C8889EA6B5FE}
EndGlobalSection
EndGlobal

28
cs5/5_2/Program.cs Normal file
View File

@@ -0,0 +1,28 @@
using System;
namespace _5_2
{
public class TemperatureCelius
{
private double degree;
public TemperatureCelius(double degree)
{
this.degree = degree;
}
public double toFahrenheit()
{
return (degree * 9 / 5) + 32;
}
}
public class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入摄氏温度:\n");
double celsius = Convert.ToDouble(Console.ReadLine());
TemperatureCelius tempCelius = new TemperatureCelius(celsius);
double fahrenheit = tempCelius.toFahrenheit();
Console.WriteLine("对应的华氏温度是:{0}\n", fahrenheit);
Console.ReadKey();
}
}
}

11
cs5/5_3/5_3.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_5_3</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
cs5/5_3/5_3.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5_3", "5_3.csproj", "{32BEEF67-DFCA-4551-90C6-9DC2246E4FF9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{32BEEF67-DFCA-4551-90C6-9DC2246E4FF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{32BEEF67-DFCA-4551-90C6-9DC2246E4FF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32BEEF67-DFCA-4551-90C6-9DC2246E4FF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32BEEF67-DFCA-4551-90C6-9DC2246E4FF9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9CE2E177-5663-42F5-9B3C-BD782E54D2D4}
EndGlobalSection
EndGlobal

10
cs5/5_3/Program.cs Normal file
View File

@@ -0,0 +1,10 @@
namespace _5_3
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}