知识点:运算
注意:
数据类型int 5/9=0
需要使用数据类型float/double, 这样5.0/9.0 != 0
#include <iostream> #include <iomanip> using namespace std; int main() { float f = 0.0; float c = 0.0; cin >> f; c = 5.0 / 9.0 * (f - 32); cout << fixed << setprecision(3); cout << c << endl; return 0; }