C#华氏温度和摄氏温度的相互专函代码片段
public static double CelsiusToFahrenheit (string temperatureCelsius)
{
double celsius = System.Double.Parse (temperatureCelsius);
return (celsius * 9 / 5) + 32;
}
public static double FahrenheitToCelsius
(string temperatureFahrenheit)
{
double fahrenheit = System.Double.Parse (temperatureFahrenheit);
return (fahrenheit - 32) * 5 / 9;
}

浙公网安备 33010602011771号