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

Posts 1–2 of 2 · Page 1 of 1
❓ 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()'
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);
}
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us