grrrrrrrrrr

This is a discussion on grrrrrrrrrr within the C++ Programming forums, part of the General Programming Boards category; error C2059: syntax error : ')' #include <iostream.h> Code: int add() { int a, b; cout<<"text"; cin>> a; cout<<"text"; cin>> ...

  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,789

    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
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    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

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