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