111
This commit is contained in:
1 parent
5478d0ed37
commit
bb4a37acc4
99 files changed
+4315
-16
No files matched your search
@@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<RootNamespace>_15._1</RootNamespace>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.14.36623.8 d17.14
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15.1", "15.1.csproj", "{816086E8-93CF-41C4-8DC4-EE4B44FE918B}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{816086E8-93CF-41C4-8DC4-EE4B44FE918B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{816086E8-93CF-41C4-8DC4-EE4B44FE918B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{816086E8-93CF-41C4-8DC4-EE4B44FE918B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{816086E8-93CF-41C4-8DC4-EE4B44FE918B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {F6856EF0-4074-451B-9ED7-D1F4FC4E61BD}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
namespace _15._1
|
||||||
|
{
|
||||||
|
class MathTriangle
|
||||||
|
{
|
||||||
|
private double sideA;
|
||||||
|
private double sideB;
|
||||||
|
private double sideC;
|
||||||
|
public MathTriangle(double a, double b, double c)
|
||||||
|
{
|
||||||
|
sideA = Math.Abs(a);
|
||||||
|
sideB = Math.Abs(b);
|
||||||
|
sideC = Math.Abs(c);
|
||||||
|
}
|
||||||
|
public double GetArea()
|
||||||
|
{
|
||||||
|
double s = (sideA + sideB + sideC) / 2;
|
||||||
|
return Math.Sqrt(s * (s - sideA) * (s - sideB) * (s - sideC));
|
||||||
|
}
|
||||||
|
public double GetPerimeter()
|
||||||
|
{
|
||||||
|
return sideA + sideB + sideC;
|
||||||
|
}
|
||||||
|
public double GetHeight()
|
||||||
|
{
|
||||||
|
double area = GetArea();
|
||||||
|
return (2 * area) / sideA;
|
||||||
|
}
|
||||||
|
public double GetMaxSide()
|
||||||
|
{
|
||||||
|
return Math.Max(sideA, Math.Max(sideB, sideC));
|
||||||
|
}
|
||||||
|
public double GetMinSide()
|
||||||
|
{
|
||||||
|
return Math.Min(sideA, Math.Min(sideB, sideC));
|
||||||
|
}
|
||||||
|
private double GetPartSideA()
|
||||||
|
{
|
||||||
|
return Math.Sqrt((Math.Pow(sideB, 2.0) - Math.Pow(GetHeight(), 2.0)));
|
||||||
|
|
||||||
|
}
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
MathTriangle triangle = new MathTriangle(16.0, 10.0, 8.0);
|
||||||
|
Console.WriteLine("三角形三边长分别为: {0}, {1}, {2}", triangle.sideA, triangle.sideB, triangle.sideC);
|
||||||
|
Console.WriteLine("三角形的面积为: {0:#.00}", triangle.GetArea());
|
||||||
|
Console.WriteLine("三角形的周长为: {0}", triangle.GetPerimeter());
|
||||||
|
Console.WriteLine("三角形的A边高为: {0:#.00}", triangle.GetHeight());
|
||||||
|
Console.WriteLine("三角形的最大边为: {0}", triangle.GetMaxSide());
|
||||||
|
Console.WriteLine("三角形的最小边为: {0}", triangle.GetMinSide());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loaded 3 of 99 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user