• 09-23-2008
ClearSights
Ok, I need help with this, Im just starting out and have no clue where to start...this is what I have to do....

Write a program to ask the user for odometer readings before and after and gallons of gas used for each of three trips. Calculate the distance and miles per gallon for each trip. Display that information in a report like:

Trip Report
Trip Start End Distance Gallons MPG
1 10078.9 10172.6 93.7 4.65 20.0
2 10364.0 10687.5 323.5 14.90 21.7
3 11538.3 11647.8 109.5 5.34 20.5

Could someone please show me where I start? I have no clue how, as stated im a beginner.
• 09-23-2008
DigitalBear
Quote:

Originally Posted by ClearSights
Ok, I need help with this, Im just starting out and have no clue where to start...this is what I have to do....

Write a program to ask the user for odometer readings before and after and gallons of gas used for each of three trips. Calculate the distance and miles per gallon for each trip. Display that information in a report like:

Trip Report
Trip Start End Distance Gallons MPG
1 10078.9 10172.6 93.7 4.65 20.0
2 10364.0 10687.5 323.5 14.90 21.7
3 11538.3 11647.8 109.5 5.34 20.5

Could someone please show me where I start? I have no clue how, as stated im a beginner.

Simple, do TripStart Minus TripEnd millage as a values to get distances

For Miles per gallon it's Miles/Gallons = MPG

Setting up the displace will just be cleaver cout codes
• 09-23-2008
ClearSights
everyone says simple but I am Very new too this....all I know how to do is little things....like cout, setw, fin, fout, endl, and other small functions
• 09-23-2008
DigitalBear
Then you got everything you need.. Read it in english

You need 3 start odometer readings right?
Code:

`float odostart1,odostart2,odostart3;// for the 3 start distances`
So now you need end distances?
Code:

`float odoend1,odoend2,odoend3;// for the 3 end distances`
Then it's just a continuation of the same math problem,
odostart-odoend = distance

and miles/gallons = MPG

The only problem I have is what are you Inputs?
• 09-23-2008
ClearSights
I didnt get any other information then what I stated....

So I would start it kind of like this?....

#include <iostream>
using namespace std;

float odostartone;
float odoendone;
float gallonsone;
float odostarttwo;
float odoendtwo;
float gallonstwo;
float odostartthree;
float odoendthree;
float gallonsthree;
• 09-23-2008
DigitalBear
Yea, You need more tho...

You can have comma's and run them rowed instead of collums

float odostartone,odostarttwo,etc..
but whatever works for you.

You also need distance1,2,3(or miles1,2,3) and MPG1(2,3) etc

cuz it's Miles/Gallons = MPG

But without proper instructions your pretty much stumped.. you can set it up so you can enter odometer start and finish 3 times each.... as well ad miles drove and it will display everything.. but it's odd he just gave you a picture and vague instructions such as.. 3 lists of odometer start end, miles, gallons and mpg.. I gotta go to bed. So i hope someone else can help. If not I'll add more tomorrow
• 09-24-2008
cyberfish
• 09-24-2008
Salem
> everyone says simple but I am Very new too this....all I know how to do is little things....like cout, setw, fin, fout, endl, and other small functions