?? temperature.cs
字號(hào):
using System;
namespace CalcTemp
{
/// <summary>
/// Summary description for Temperature.
/// </summary>
public class Temperature {
private float temp, newTemp;
//-------------
public Temperature(string thisTemp) {
temp = Convert.ToSingle(thisTemp);
}
//-------------
public string getConvTemp(bool celsius){
if (celsius)
return getCels();
else
return getFahr();
}
//-------------
private string getCels() {
newTemp= 5*(temp-32)/9;
return newTemp.ToString() ;
}
//-------------
private string getFahr() {
newTemp = 9*temp/5 + 32;
return Convert.ToString(newTemp) ;
}
public string getKelvin() {
float ttemp = (float)(5*(temp - 32)/9 +273.16);
return ttemp.ToString ();
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -