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
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();
}
}
}