Syntax Error

Hi guys: Can any one please help me in the syntax error on line         if code == 'A'

using namespace test;

int main()
        double hourlyRates[6] = {11.25, 10.0, 9.85, 8.65, 25.0, 25.0};
        char code = ' ';
        cout << "Pay code (A - F):";
        cin >> code;
        code = toupper(code);
        if code == 'A'
              cout << "Hourly rate: $" << hourlyRates[0] << endl;
        else if code == 'B'
              cout << "Hourly rate: $" << hourlyRates[1] << endl;
        else if code == 'C'
              cout << "Hourly rate: $" << hourlyRates[2] << endl;
        else if code == 'D'
              cout << "Hourly rate: $" << hourlyRates[3] << endl;
        else if code == 'E'
              cout << "Hourly rate: $" << hourlyRates[4] << endl;
        else if code == 'F'
              cout << "Hourly rate: $" << hourlyRates[5] << endl;
              cout << "Invalid pay code" << endl;
        return 0;
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
"If" statements (and "else if") require parentheses around the condition:
if (code == 'A')

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
>> if code == 'A'

Replace with:
     if( code == 'A' )


else( if code == 'B' )
käµfm³d 👽Commented:

Did you invent a new "else if"    ; )

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

:) thanks for noticing the typo. Should have been
     else if ( code == 'B' )
mustish1Author Commented:
thanks just mix the coding style of one language into another.
I used to have trouble writing C++ and Java in the same day. But compiler errors quickly sorted out the confusion.
mustish1Author Commented:
Thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.