📜  c++代码示例中的温度转换

📅  最后修改于: 2022-03-11 14:44:46.658000             🧑  作者: Mango

代码示例1
#TemperatureConversions.py

def main():
    units = input("Which temperature you are using? (F for Fahrenheit, C for Celsius): ")
    temp = eval(input("Please enter the temperature: "))
    if (units == 'F'):
        celcius = 5*(temp - 32)/9
        print("The temperature is", celcius, "Celcius.")
    else:
        fahrenheit = 9*temp / 5+32
        print("The temperature is", fahrenheit, "Fahrenheig")
main()