cpp_primer_plus/ch03/07.cpp

14 lines
328 B
C++
Raw Normal View History

2022-08-24 05:44:15 +08:00
# include <iostream>
using namespace std;
double km2mile = 0.6214;
double ga2l = 3.875;
int main(){
double ga, mi, eu_rate;
cout << "The usage of oil (L) per 100 km: ";
cin >> eu_rate;
double us_rate = km2mile * ga2l / eu_rate;
cout << "Every gallon, the driver can drive " << us_rate << " mile(s)" << endl;
return 0;
}