### Problems with functions

I need to find x, y, sum and modulus of difference between y and sum using functions. But the program does not calculate the functions. Here is my code:

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667`` ``````#include #include #include "math.h" using namespace std; int findX(double x, double sum, int r, int k, double a, double b, double h, double n); int findY(double x, double sum, int r, int k, double a, double b, double h, double n, double y); int findSum(double x, double sum, int r, int k, double a, double b, double h, double n); int findMod(double x, double sum, int r, int k, double a, double b, double h, double n, double mod, double y); int main() { double a, b, x, h, r, sum, y, mod; int n, k; cout<<"Input a = "; cin>>a; cout<<"Input b = "; cin>>b; cout<<"Input h = "; cin>>h; cout<<"Input n = "; cin>>n; cout<
Last edited on
Lines 22-25 are function declarations, not function calls.

PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Thank you for the hint! But how can I correct this?
int result = findX(somevariable, 12, 5, anothervariable, ... etc.. );
you call it with values you have (variables, constants, etc) and put the result into a variable or use it directly (such as cout << findX(...stuff) << ) but usually you will store the result in a variable.

notice no types when it is CALLED, and the variables and constants don't have to name-match the parameters.

a smaller simpler example...
int sum(int a, int b)
{
return a+b;
}

...
z = sum(1,2);
x = sum(3,4);
y = sum(z,x);

like that.
Last edited on
Topic archived. No new replies allowed.