Hey everyone. I am supposed to create a program that will input the miles driven and gallons used for each tank full of gas. program has to calculate and display the miler per gallon obtained for each tankful and print the combined miles per gallon for all tank fulls up to that point.

I am trying to figure out how i would actually go about doing this. i have a rough idea but i know this is not going to work. i have been trying to figure it out for ever, anybody care to point me in the right direction? here is my pseudocode so far...

Initialize mpg to 0
initialize tank to 1
Int miles
Int gallons

While not sentinel value
Prompt the user to enter the miles driven
Prompt user to enter total gallons used



Print the total mpg

That code looks like you are on the right track, however, I'm not so sure about the "Miles++ and Gallons++" part. Instead of incrementing them, don't you want to add the values input to those variables? Also, you might want to create some separate variables to keep track of the total miles driven and total gallons used. Then at the end of the program you will be able to calculate the total mpg.

Hope that helps!