Hey guys,
Just got started on this, and I keep getting an error saying Missing ";" before "." starting at line 25 and pretty much on all of my functino calls in main.
Anyone know what I'm doing wrong?
Here's my code:
//driver - main
#include "prob6.h"
int main ( )
{
int a = 0 ;
int selection ;
double fuelEff ;
double miles ;
do
{
cout << "Make a selection" << endl ;
cout << "1. Enter fuel effeciency (in MPG): " << endl ;
cout << "2. Add miles to odometer: " << endl ;
cout << "3. Reset odometer: " << endl ;
cout << "4. Output gallons consumed: " << endl ;
cin >> selection ;
switch ( selection )
{
case 1:
cout << "Please enter the vehicle's fuel effeciency in MPG: " << flush ;
cin >> fuelEff ;
Odometer.setMPG ( fuelEff ) ;
break ;
case 2:
cout << "Please enter the miles in which to add to the current odometer reading: " << flush ;
cin >> miles ;
Odometer.setOdom
break ;
case 3:
Odometer.resetOdom ( ) ;
cout << "Odometer has been reset" << endl ;
break ;
case 4:
Odometer.outGalConsumed ( ) ;
break ;
case 5:
a = 1 ;
break ;
default:
cout << "Invalid selection - Please limit selection to numbers 1 through 5" << endl ;
}
} while ( a == 0 ) ;
return 0 ;
}
//functions
#include "prob6.h"
void Odometer::setMPG ( double x )
{
mpg = x ;
}
void Odometer::resetOdom ( )
{
odom = 0 ;
}
void Odometer::setOdom ( double x )
{
odom += x ;
}
void Odometer::outGalConsumed ( )
{
double x ;
x = ( odom / mpg ) ;
cout << setprecision ( 2 ) << x << "mpg" << endl ;
}
//header file
#pragma once
#include <iomanip>
#include <iostream>
using namespace std ;
class Odometer
{
public:
void setMPG ( double ) ;
void resetOdom ( ) ;
void setOdom ( double ) ;
private:
void outGalConsumed ( ) ;
double odom ;
double mpg ;
double galConsumed ;
} ;