Archived
1
0
This commit is contained in:
2025-10-24 17:20:56 +08:00
Unverified
parent acc0c9e220
commit e0fbc20716
21 changed files with 0 additions and 0 deletions

View File

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

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}") = "C Sharp 1_2", "C Sharp 1_2.csproj", "{8832C7BB-57A7-443D-BE9A-0666612F71AA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8832C7BB-57A7-443D-BE9A-0666612F71AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8832C7BB-57A7-443D-BE9A-0666612F71AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8832C7BB-57A7-443D-BE9A-0666612F71AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8832C7BB-57A7-443D-BE9A-0666612F71AA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {30FC1B92-3A5C-409D-8B1F-141D6ED8F503}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,29 @@
using System;
namespace C_Sharp_1_2
{
public class Program
{
static void Main(string[] args)
{
Console.Write("请输入三角形的边长a");
double a = double.Parse(Console.ReadLine());
Console.Write("请输入三角形的边长b");
double b = double.Parse(Console.ReadLine());
Console.Write("请输入三角形的边长c");
double c = double.Parse(Console.ReadLine());
if (a + b > c && a + c > b && b + c > a)
{
double perimeter = a + b + c;
double s = (a + b + c) / 2;
double area = Math.Sqrt(s * (s - a) * (s - b) * (s - c));
Console.WriteLine("三角形的三边长为a={0}b={1}c={2}", a, b, c);
Console.WriteLine("三角形的周长为{0},面积为:{1}",perimeter,area);
}
else
{
Console.WriteLine("输入的边长不能构成三角形。");
}
Console.ReadLine();
}
}
}