Write a C++ program that reads the Capacity (in

gallons)of an automobile fuel
tank, and Miles per gallon this
automobile can be driven. It outputs the number
of miles this automobile is driven without refueling

http://www.jiskha.com/display.cgi?id=1400341394

If you could use further help, post what you've got so far, and we'll take it from there.

I have no idea. Can someone help me please

To write a C++ program that calculates the number of miles an automobile can be driven without refueling, we can follow these steps:

1. Declare and initialize variables for the capacity of the fuel tank and miles per gallon.
2. Take input from the user for the capacity and miles per gallon.
3. Calculate the number of miles that can be driven without refueling using the formula: miles = capacity * miles per gallon.
4. Output the calculated number of miles.

Here's the code example:

```cpp
#include <iostream>

int main() {
double capacity, milesPerGallon;

// Step 1: Initialize variables
capacity = 0.0;
milesPerGallon = 0.0;

// Step 2: Take input from the user
std::cout << "Enter the capacity of the fuel tank (in gallons): ";
std::cin >> capacity;

std::cout << "Enter the miles per gallon: ";
std::cin >> milesPerGallon;

// Step 3: Calculate the number of miles driven without refueling
double miles = capacity * milesPerGallon;

// Step 4: Output the result
std::cout << "Number of miles driven without refueling: " << miles;

return 0;
}
```

Explanation of Code:

1. The `main()` function is the entry point of the program.
2. We declare two double variables to store the capacity of the fuel tank and miles per gallon.
3. Step 1 is initializing both variables to zero.
4. Step 2 prompts the user to enter the capacity and miles per gallon, and we store the user input in the respective variables.
5. Step 3 calculates the number of miles that can be driven without refueling by multiplying the capacity and miles per gallon.
6. Step 4 displays the calculated result.
7. Finally, we return 0 to indicate successful program execution.