You are here:

C++/Simple program help


Hello, I am still pretty new to C++ and I have this program I need to write that has been giving me issues. I believe for the most part I have the program all figured out, the main part that is stumping me is the equation process. I am sure this is simple but I just cant seem to think it through clearly.

Here is the problem. I am asked to write up a program that can determine how many kilometers can be driven on a tank of gas based on tank size (in gallons), miles driven, and gallons left. (assuming the tank was full at the beginning of the trip) they also want me to make 2 decimal places for the first kilometer output along with a whole kilometer output right next to it.

here is my code:

if any other you see any other issues with my code please tell me..I am still pretty unclear of it as a whole even though I feel I got the general write out of it right.


I have seen your code, I think you are doing the right thing. You didn't add the mathematical aspect of how to get the miles driven. So, here is a link to get that from and then apply the mathematics to your code.


All Answers

Answers by Expert:

Ask Experts




I can confidently answer any question both basic and advanced in C++. Areas like templates, algorithms, Gui and design patterns are of interest to me. i will not answer questions about web programming.


I have a 3- year- work experience in software Engineering.

I am a bachelor of Engineering graduate

©2017 All rights reserved.

[an error occurred while processing this directive]