Question
Why didn't some of my code run? miles_per_gallon_of_fruel = fruel_consumed_in_liters = liters_per_100kms = what should I do? #include #include using namespace std; int main() {
Why didn't some of my code run?
miles_per_gallon_of_fruel = fruel_consumed_in_liters = liters_per_100kms =
what should I do?
#include #include using namespace std;
int main() { double starting_mileage_in_miles, ending_mileage_in_miles, number_of_miles_traveled, number_of_kms_traveled, starting_fruel_level, ending_fruel_level, fruel_consumed_in_gallons, fruel_consumed_in_liters, miles_per_gallon_of_fruel, liters_per_100kms, km, miles, liters, gallons; cout << setprecision(2) << fixed; cout << "Enter starting_mileage_in_miles: "; cin >> starting_mileage_in_miles; cout << endl; cout << "Enter ending_mileage_in_miles: "; cin >> ending_mileage_in_miles; cout << endl;
cout << "Enter starting_fruel_level in gallons: "; cin >> starting_fruel_level; cout << endl; cout << "Enter ending_fruel_level in gallons: "; cin >> ending_fruel_level; cout << endl; fruel_consumed_in_gallons = starting_fruel_level - ending_fruel_level; cout << "fruel_consumed_in_gallons = " << fruel_consumed_in_gallons << endl; number_of_miles_traveled = ending_mileage_in_miles - starting_mileage_in_miles; cout << "number_of_miles_traveled = " << number_of_miles_traveled << endl;
miles_per_gallon_of_fruel = number_of_miles_traveled / fruel_consumed_in_gallons; cout << "miles_per_gallon_of_fruel = "; cout << endl; number_of_kms_traveled = number_of_miles_traveled * 1.609; cout << "number_of_kms_traveled = " << number_of_kms_traveled << endl; fruel_consumed_in_liters = fruel_consumed_in_gallons / 2.785; cout << "fruel_consumed_in_liters = " << endl; liters_per_100kms = fruel_consumed_in_liters / 100; cout << "liters_per_100kms = " << endl; return 0; }
Enter starting_mileage_in_miles: 300 Enter ending_mileage_in_miles: 650.45 Enter starting_fruel_level in gallons: 19 Enter ending_fruel_level in gallons: 2
fruel_consumed_in_gallons = 17.00 number_of_miles_traveled = 350.45 miles_per_gallon_of_fruel = number_of_kms_traveled = 563.87 fruel_consumed_in_liters = liters_per_100kms =
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started