i am currently in a c++ class and i am new to all this
for some reason i do not get this math for the program.....please help
i have to create a program that will determine the cost of a vacation by car to a variety of locations
distance
price per gallon
miles per gallon
i got this so far
#include <iostream>
#include<iomanip>
using namespace std;
int main()
{
float distance=0.0;
float costpergallon=0.0;
float milespergallon=0.0;
cout<<" enter trip distance ";
cin>>distance;
cout<<" enter cost per gallon of gas ";
cin>>costpergallon;
cout<<" enter miles per gallon of gas ";
cin>>milespergallon;
cost=(distance / milespergallon)*pricepergallon;
cout<<" trip distance "<<setprecision(2)<<tripdistance<<'\n'
<<" cost per gallon "<<setprecision(2)<<costpergallon<<'\n'
<<" miles per gallon "<<setprecision(2)<<milespergallon<<'\n'
<<" cost to use this vehicle for trip "<<setprecision(2)<<costtousethisvehiclefortrip<<endl;
This is grade school math.
How many miles do you have to travel?
How many gallons of gas will that take if you know the miles per gallon of the car?
How much will the gas cost if you know the cost per gallon?
i figured out the math dont know how to type it
another words not sure how to finish this program so program works
i know the math is distance / miles per gallon *price per gallon