don't put a type on function calls, only when you create them or do headers.
its just
line 63
calculateRadius(radius);
except it isnt, because its
calculateRadius(many, variables, here, ...) //you need all those variables
and, radius isnt created anywhere yet, has to exist before you call a function with it :)
I think you want:
double radius = calculateRadius(x1,x2,y1,y2); //this creates the variable radius and then assigns the result of the function call to it. see how you created this function to accept 4 variables and see how I call it with 4 variables? You can do some smoke and mirrors to call with less than it needs but that is another topic for another day. Generally, you want a one to one parameter called to defined structure.
but you can't create them inside the call, so this is wrong:
double radius = calculateRadius(double x12, double x13, double y42, double y45);
and a little more: radius is a double in the calculate function, but the function returns int. it should return radius and be of type double:
1 2 3 4 5 6 7 8
|
double calculateRadius(double x1, double x2, double y1, double y2)
{
double radius = sqrt(pow (x2 - x1 , 2) + pow (y2 - y1 , 2));
cout << "Radius: " << radius << endl;
return radius;
}
|
this allows you to USE the function's result, beyond just printing it to the screen and losing it forever.
the radius in the function and the one in main are NOT the same variable, so you still need to copy it (assign it) into the one in main as I showed above.