954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

missing ";" before "." ----

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:

<pre><code>//driver - main
#include &quot;prob6.h&quot;

int main ( )
{
    int a = 0 ;
    int selection ;
    double fuelEff ;
    double miles ;

    do
    {
    cout &lt;&lt; &quot;Make a selection&quot; &lt;&lt; endl ;
    cout &lt;&lt; &quot;1. Enter fuel effeciency (in MPG):  &quot; &lt;&lt; endl ;
    cout &lt;&lt; &quot;2. Add miles to odometer:  &quot; &lt;&lt; endl ;
    cout &lt;&lt; &quot;3. Reset odometer:  &quot; &lt;&lt; endl ;
    cout &lt;&lt; &quot;4. Output gallons consumed:  &quot; &lt;&lt; endl ;
    cin &gt;&gt; selection ;

    switch ( selection )
    {
    case 1:
        cout &lt;&lt; &quot;Please enter the vehicle's fuel effeciency in MPG:  &quot; &lt;&lt; flush ;
        cin &gt;&gt; fuelEff ;
        Odometer.setMPG ( fuelEff ) ;
        break ;
    case 2:
        cout &lt;&lt; &quot;Please enter the miles in which to add to the current odometer reading:  &quot; &lt;&lt; flush ;
        cin &gt;&gt; miles ;
        Odometer.setOdom
        break ;
    case 3:
        Odometer.resetOdom ( ) ;
        cout &lt;&lt; &quot;Odometer has been reset&quot; &lt;&lt; endl ;
        break ;
    case 4:
        Odometer.outGalConsumed ( ) ;
        break ;
    case 5:
        a = 1 ;
        break ;
    default:
        cout &lt;&lt; &quot;Invalid selection - Please limit selection to numbers 1 through 5&quot; &lt;&lt; endl ;
    }
    } while ( a == 0 ) ;

    return 0 ;
}




//functions
#include &quot;prob6.h&quot;

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 &lt;&lt; setprecision ( 2 ) &lt;&lt; x &lt;&lt; &quot;mpg&quot; &lt;&lt; endl ;
}



//header file
#pragma once

#include &lt;iomanip&gt;
#include &lt;iostream&gt;
using namespace std ;

class Odometer
{
public:
    void setMPG ( double ) ;
    void resetOdom ( ) ;
    void setOdom ( double ) ;
private:
    void outGalConsumed ( ) ;
    double odom ;
    double mpg ;
    double galConsumed ;
} ;</code></pre>
Duki
Nearly a Posting Virtuoso
1,475 posts since Jun 2006
Reputation Points: 817
Solved Threads: 32
 

Odometer is the name of the class, not of an object.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

ah, gracias!

Duki
Nearly a Posting Virtuoso
1,475 posts since Jun 2006
Reputation Points: 817
Solved Threads: 32
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You