locked
Why do i get error message - 1."variable " reported by my compiler 2. missing semi colon. Any help,Thanks RRS feed

  • Question

  • #include "stdafx.h"

    #include "iostream"

    using namespace std;

     

    double GetAnnualPremium();

    double GetCoverage();

    double GetPolicy();

    double Cover;

    double CalculatePremium(double Rt, double Cvr, double Plc);

    int main()

    {

    double Rate, Coverage, Policy, Premium;

    cout << " Fire insurance customer processing\n";

    Rate = GetAnnualPremium();

    Coverage = GetCoverage();

    Policy = GetPolicy();

    Premium = CalculatePremium( Rate, Coverage, Policy)

    cout << "==================================\n";

    cout << "Fire insurance customer qoute\n";

    cout << "__________________________________\n";

    cout << " Annual premium " << "$" << Rate;

    cout << " Coverage " << "$" << Coverage;

    cout << " Policy " << "$" << Policy;

    return 0;

    }

    double GetAnnualPremium()

    {

    double AnlPrem;

    cout << " Enter Annual Premium = $:";

    cin >> AnlPrem;

    return AnlPrem;

    }

    double GetCoverage()

    {

    double Cover;

    cout << " Enter Coverage = $:";

    cin >> Cover;

    return Cover;

    }

    double GetPolicy()

    {

    double poly;

    cout << " Enter Policy = $:";

    cin >> Poly;

    return Poly;

    }

    double CalculatePremium(double Rate, double Cover, double Poly)

    {

    double Prem;

    Unit = Poly/Cover;

    Prem = Rate * Unit;

    return Prem;

    }

    =====================================

    ------ Rebuild All started: Project: Fire Insurance2, Configuration: Debug Win32 ------

    Deleting intermediate and output files for project 'Fire Insurance2', configuration 'Debug|Win32'

    Compiling...

    stdafx.cpp

    Compiling...

    Fire Insurance2.cpp

    c:\documents and settings\austine.proff\my documents\visual studio 2008\projects\fire insurance2\fire insurance2\fire insurance2.cpp(27) : error C2146: syntax error : missing ';' before identifier 'cout'

    c:\documents and settings\austine.proff\my documents\visual studio 2008\projects\fire insurance2\fire insurance2\fire insurance2.cpp(58) : error C2065: 'Poly' : undeclared identifier

    c:\documents and settings\austine.proff\my documents\visual studio 2008\projects\fire insurance2\fire insurance2\fire insurance2.cpp(59) : error C2065: 'Poly' : undeclared identifier

    c:\documents and settings\austine.proff\my documents\visual studio 2008\projects\fire insurance2\fire insurance2\fire insurance2.cpp(64) : error C2065: 'Unit' : undeclared identifier

    c:\documents and settings\austine.proff\my documents\visual studio 2008\projects\fire insurance2\fire insurance2\fire insurance2.cpp(65) : error C2065: 'Unit' : undeclared identifier

    Build log was saved at "file://c:\Documents and Settings\Austine.PROFF\My Documents\Visual Studio 2008\Projects\Fire Insurance2\Fire Insurance2\Debug\BuildLog.htm"

    Fire Insurance2 - 5 error(s), 0 warning(s)

    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    Monday, March 10, 2008 4:47 PM

Answers

  •  

    I won't address all of the error messages, as you should learn how

    to analyze them yourself. These are rudimentary and common errors.

     

    (1) missing ';' before identifier 'cout'

    means exactly what it says. Look at the line before it and

    see if you terminated it properly with a semi-colon.

     

    (2) C and C++ are case-sensitive languages.

    Therefore words like "poly" and "Poly" are NOT

    the same.

     

    - Wayne

     

    Monday, March 10, 2008 5:26 PM