描述输入一个华氏温度 要求输出摄氏温度 公式为c=F−32∗59。输入描述数据包含有多行每一行都是一个华氏温度整数。输出描述对于每一个华氏温度输出对应的摄氏温度每个一行。保留两位小数。希望能用c++编写代码
#include
using namespace std;
int main() { int fahrenheit;
while (cin >> fahrenheit) {
double celsius = (fahrenheit - 32) * 5.0 / 9;
cout << fixed << setprecision(2) << celsius << endl;
}
return 0;
}
原文地址: http://www.cveoy.top/t/topic/jat3 著作权归作者所有。请勿转载和采集!