Help!!! Can't see what's wrong?

This is a discussion on Help!!! Can't see what's wrong? within the C++ Programming forums, part of the General Programming Boards category; I have been trying to figure what is wrong. I have 1 error this is what it says line 20 ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    5

    Exclamation Help!!! Can't see what's wrong?

    I have been trying to figure what is wrong. I have 1 error this is what it says
    line 20 parse error before `)'

    I am using Dev C++ 4. Can you please help me with this. I looks right but i don't know what's missing. Thanks for any help.

    #include <iostream.h>
    #include <stdlib.h>

    void main ()
    {
    int choice,price,totalprice;
    float NYCsalestax=0,Chicagosalestax=0.085,Bostonsalestax =0.10;

    cout<<"Type 1 for the total price of a DVD player in NYC\n";
    cout<<"Type 2 for the total price of a DVD player in Chicago\n";
    cout<<"Type 3 for the total price of a DVD player in Boston\n";
    cin>>choice;
    if (choice==1)
    {
    cout<<"Enter the price of the DVD player in New York City $";
    cin>>price;
    totalprice=price+price*NYCsalestax;
    cout<<"The total price of the DVD player New York is $";
    cout<<totalprice;
    )
    if (choice==2)
    {
    cout<<"Enter the price of the DVD player in Chicago $";
    cin>>price;
    totalprice=price+price*Chicagosalestax;
    cout<<"The total price of the DVD player Chicago is $";
    cout<<totalprice;
    }
    if (choice==3)
    {
    cout<<"Enter the price of the DVD player in Boston $";
    cin>>price;
    totalprice=price+price*Bostonsalestax;
    cout<<"The total price of the DVD player Boston is $";
    cout<<totalprice;
    }
    system("PAUSE");
    }

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    162
    You need to use else if on your second and third if statements, I think.

  3. #3
    31173 h4x0r gnu-ehacks's Avatar
    Join Date
    Nov 2001
    Posts
    556
    Yeah, on line 20, you ended the code section with a ')'. It's suppose to be '}'.
    What will people say if they hear that I'm a Jesus freak?
    What will people do if they find that it's true?
    I don't really care if they label me a Jesus freak, there is no disguising the truth!

    Jesus Freak, D.C. Talk

    -gnu-ehacks

  4. #4
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    replace the end parenthesis on line 20 [first if] with an end bracket '}'... also, i recommend you use a switch instead of three conditionals...
    hasafraggin shizigishin oppashigger...

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    I recommend actually reading the error messages, they're not just there to tell you that something is wrong, they actually attempt to tell you what and where.

    -Prelude
    My best code is written with the delete key.

  6. #6
    Registered User
    Join Date
    Dec 2001
    Posts
    5

    Talking

    Thank you very much. How could I have not seen it? I went over it so many times. Thank you all so much. To the person who told me about the the Switch. I would use it, but the class I am in is not up to it. Thanks again. I really appricate it.
    Thanks
    Krazy380

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 04:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 01:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 02:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21