问题:
解答:
cpp
#include <iostream>
using namespace std;
const float GALLO_TO_LITRE = 3.785;
const float KM_TO_MILE = 62.14;
int main()
{
float litre = 0;
float gallo = 0;
float mile = 0;
cout << "请输入汽车油耗(每100km消耗的汽油量单位为升):";
cin >> litre;
gallo = litre / GALLO_TO_LITRE;
mile = KM_TO_MILE / gallo;
cout << "每100KM" << litre << "升 转化为 " << "每加仑" << mile << "英里" << endl;
return 0;
}
运行结果:
还是单位的转化,哈哈哈
第三章完结撒花!
2024年8月23日20:48:46