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

  

posted @ 2013-06-23 14:30  冰封的心  阅读(515)  评论(0)    收藏  举报