C++ Program Question

I need some help. I am trying to complete an exercise, however I am stuck. Here is the Exercise: Write a C++ program that prompts the capacity in gallons of an automobile fuel tank and the miles per gallon the automobile can be driven. The program outputs the number of miles the automobile can be driven without refueling. Be sure to properly comment your code. I really need some help with this.
however I am stuck

where exactly did you get stuck?
What you need to do is output messages to the screen with "std::cout" and read in the input with "std::cin"

Below is a template you could use to asssist you in your exercise.
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
int main()
{

int x = 0; //This variable is type int. 

std::cout << "Enter whatever you want to prompt the user for here\n";
std::cin >> x; //store the information in a variable 

cout << x; //output the information to the screen
cin.get(); //Pause the program before it closes
return 0;
}


Run the above code to see what it does, then customise it to solve your problem. Goodluck
Last edited on
Thank you so much!
Topic archived. No new replies allowed.