Archived
1
0

Initial commit

This commit is contained in:
2025-10-24 17:19:46 +08:00
Unverified
commit acc0c9e220
155 changed files with 77369 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>C_Sharp_1_5</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}") = "C Sharp 1_5", "C Sharp 1_5.csproj", "{F61264D6-1D87-49B4-95DE-DE6F15D87093}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F61264D6-1D87-49B4-95DE-DE6F15D87093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F61264D6-1D87-49B4-95DE-DE6F15D87093}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F61264D6-1D87-49B4-95DE-DE6F15D87093}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F61264D6-1D87-49B4-95DE-DE6F15D87093}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5C19FCB6-F862-406A-828F-804B5E63FE05}
EndGlobalSection
EndGlobal
+44
View File
@@ -0,0 +1,44 @@
using System;
using static System.Math;
namespace C_Sharp_1_5
{
public class Program
{
static void Main()
{
double a, b, c, delta, real, imag;
Console.Write("请输入系数a");
a = double.Parse(Console.ReadLine());
Console.Write("请输入系数b");
b = double.Parse(Console.ReadLine());
Console.Write("请输入系数c");
c = double.Parse(Console.ReadLine());
if (a == 0 && b == 0)
{
Console.WriteLine("该方程无解");
}
else
{
delta = b * b - 4 * a * c;
if (delta > 0)
{
double x1 = (-b + Sqrt(delta)) / (2 * a);
double x2 = (-b - Sqrt(delta)) / (2 * a);
Console.WriteLine("该方程有两个不等实根,分别为:x1={0},x2={1}", x1, x2);
}
else if (delta == 0)
{
double x = -b / (2 * a);
Console.WriteLine("该方程有两个相等实根,均为:x={0}", x);
}
else
{
real = -b / (2 * a);
imag = Sqrt(-delta) / (2 * a);
Console.WriteLine("该方程有两个共轭复根,分别为:x1={0}+{1}i,x2={0}-{1}i", real, imag);
}
}
}
}
}