Question: Please identify and explain the key expressions used in the code below to calculate the value of mpg. #include using namespace std; int main() {
Please identify and explain the key expressions used in the code below to calculate the value of mpg.
#include
using namespace std;
int main() { //declaring variables double miles; double gallons; float mpg;
//Prints Enter miles on screen cout << "Enter miles:"; //Stores integer given user input cin >> miles; //Prints Enter gallons on screen cout << "Enter gallons:"; //Stores integer given user input cin >> gallons; //Display mileage mpg = (float)miles / gallons; //Prints Miles per gallons on screen and flush stream cout << "Miles per gallons:" << mpg << endl; //Terminate the program return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
