Results 1 to 2 of 2
  1. #1
    GhostMode1's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Behind You
    Posts
    284
    Reputation
    23
    Thanks
    610
    My Mood
    Yeehaw

    Question I need help with simple piece of c++ code getting errors

    Hello I'm new to c++ I'm taking classes at high school here is the code i need help with

    Code:
    #include <iostream>
    
    using namespace std;
    
    int sumofthree(int a,int b, int c);
    
    double LinearFunction(double m, int b, int x);
    
    int getCharacter(int a);
    
    void theFunctionofNoReturn();
    
    double distance(int x1,int y1,int x2, int y2);
    
    
    int main()
    
    {
        cout << sumofthree(3,5,2)<<endl;
        cout << LinearFunction(1,2,3)<<endl;
        cout << getCharacter(9)<<endl;
        theFunctionofNoReturn();
        cout << distance(int x1=5,int y1=5,int x2=10, int y2=10)<<endl;
    }
    
    int sumofthree(int a, int b, int c)
    
    {
        return (a+b+c);
    
    }
    
    double LinearFunction(double m, int b, int x)
    
    {
        return (m*x+b);
    }
    
    int getCharacter(int a)
    
    {
        return(a=65);
    }
    
    void theFunctionofNoReturn()
    {
        cout<< "*********************" <<endl;
        cout<< "*      NO RETURN    *" <<endl;
        cout<< "*********************" <<endl;
    }
    
    double distance()
    {
        return(int x1,int y1)-(int x2,int y2);
    }

    ok and here is the error i get when i click build and run

    Code:
          ||In function 'int main()':|
    |23|error: expected primary-expression before 'int'|
    |23|error: expected primary-expression before 'int'|
    |23|error: expected primary-expression before 'int'|
    |23|error: expected primary-expression before 'int'|
                    ||In function 'double distance()':|
    |54|error: expected primary-expression before 'int'|
    |54|error: expected ')' before 'int'|
    ||=== Build finished: 6 errors, 0 warnings ===|

    HELP me tell me whats wrong i need help its due tommorow


    Ok im down to 2 errors the one after in function 'double distance()'
    Last edited by GhostMode1; 10-02-2012 at 05:38 PM. Reason: Down to 2 errors now

  2. #2
    giniyat101's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Location
    Not telling.
    Posts
    1,935
    Reputation
    130
    Thanks
    1,380
    My Mood
    Dead
    fixes in green

    Code:
    #include <iostream>
    
    using namespace std;
    
    int sumofthree(int a,int b, int c);
    
    double LinearFunction(double m, int b, int x);
    
    int getCharacter(int a);
    
    void theFunctionofNoReturn();
    
    double distance(int x1,int y1,int x2, int y2);
    
    
    int main()
    
    {
        cout << sumofthree(3,5,2)<<endl;
        cout << LinearFunction(1,2,3)<<endl;
        cout << getCharacter(9)<<endl;
        theFunctionofNoReturn();
        cout << distance(5,5,10,10)<<endl;
    }
    
    int sumofthree(int a, int b, int c)
    
    {
        return (a+b+c);
    
    }
    
    double LinearFunction(double m, int b, int x)
    
    {
        return (m*x+b);
    }
    
    int getCharacter(int a)
    
    {
        return(a=65);
    }
    
    void theFunctionofNoReturn()
    {
        cout<< "*********************" <<endl;
        cout<< "*      NO RETURN    *" <<endl;
        cout<< "*********************" <<endl;
    }
    
    double distance(int x1,int y1,int x2, int y2)
    {
        return(x1,y1)-(x2,y2);
    }


     



    [img]https://i43.photobucke*****m/albums/e367/DeteSting/Steam-update.gif[/img]

Similar Threads

  1. Need help with a simple macro
    By marko4452 in forum Programming Tutorial Requests
    Replies: 1
    Last Post: 08-13-2012, 03:00 PM
  2. [Help Request] need help with modding
    By BayBee Alyn in forum Combat Arms Help
    Replies: 0
    Last Post: 04-27-2011, 09:06 PM
  3. [Solved] New modder Need help with simple text input NOOB!!
    By rotceh_dnih in forum Call of Duty Black Ops GSC Modding Help & Discussion
    Replies: 3
    Last Post: 02-28-2011, 04:26 AM
  4. I/Hejsan need help with a piece of code:
    By Mr.Magicman in forum C++/C Programming
    Replies: 7
    Last Post: 05-27-2010, 11:55 PM
  5. Need help with some long forgotten VB code...
    By ROUGHS3X in forum Combat Arms Help
    Replies: 0
    Last Post: 10-29-2009, 07:45 PM