Thread: grrrrrrrrrr

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    32

    grrrrrrrrrr

    error C2059: syntax error : ')'

    #include <iostream.h>

    Code:
    int add()
    {
       int a, b;
       cout<<"text";
       cin>> a;
       cout<<"text";
       cin>> b;
       cout<<"The sum is " << a+b << endl;
       //now here in the add function would i put
       return a+b; //or return EXIT_SUCCESS
    }
    int main()
    {
      char sign;
      cout<<"text";
      cin>> sign;
      if( sign == + );
      {
       add();
       return 0;
      } 
       return 0;
    }
    can someone find error with this?

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: grrrrrrrrrr

    Originally posted by helbovine
    error C2059: syntax error : ')'

    #include <iostream.h>

    Code:
      if( sign == + );
    can someone find error with this?
    if( sign == '+' );

  3. #3
    Unregistered
    Guest

    Lightbulb I suppose

    Hi,
    also I think there is should be no semicolon after the end of if statement
    if (sign=='+')//no semicolon

    I hope it helps.

  4. #4
    it'll compile if you put a semi-colon on some compilers, it'll just ignore the if statement when you run the program.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Has anyone used libmpeg3
    By taps in forum Linux Programming
    Replies: 3
    Last Post: 01-11-2002, 06:25 AM