Archived
1
0
This commit is contained in:
2025-11-01 08:20:49 +08:00
Unverified
parent e0fbc20716
commit 6151e4f8c9
29 changed files with 1010 additions and 3 deletions
+11
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
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
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));
}
}
}
}