I trying to make this program .I tried several techniques to fix it but nothing worked for me .Can anyone please tell me what is the problem with this program.
#include<iostream>
using namespace std;
double MilesperGal(double F,double m)
{
double M;
This looks the same as the thread which jsmith is helping you with.
Why are you duplicating and why don`t you put your code within code tags?? by selecting the code and hitting # under format (RHS of code window)This really helps others to read you code.
#include<iostream>
usingnamespace std;
double MilesperGal(double F,double m)
{
double M;
M = m/F;
return M;
}
double mileage(double F,double M)
{
double m;
m=F*M;
return m;
}
double fuelUsed (double M,double MPG)
{
double f;
f=M/MPG;
return f;
}
int main()
{
double FuelUsed;
double Mileage;
double MilesPerGal;
char x ;
cout<<"Enter M to caluculate mileage , D for distance traveled ,G for Gal per miles and Q to quit the program ";
cin>>x ;
cout << x << endl ;
switch (x)
{
case'm':
case'M':
cout << "enter the fuel used";
cin>>FuelUsed;
cout<<"enter mileage ";
cin>>Mileage;
cout <<double MilesperGal(double F,double m);
//otherwise you declare the function not call it. This problem occurs 2 more times
break ;
case'd':
case'D':
cout << "enter the fuel used";
cin>>FuelUsed;
cout<<"enter MPG ";
cin>>MilesPerGal;
cout <<double mileage(double F,double M);
break ;
case'g':
case'G':
cout << "enter the Mileage used";
cin>>Mileage;
cout<<"enter mileage ";
cin>>MilesPerGal;
cout << double fuelUsed (double M,double MPG) ;
default:
return 0; }
}