i cannot change the function declaration
i used int instead of void to test it, and with int it works obsolutly fine, but void is getting me confused, prof said i need a local variable, im trying it, but its not to succesful
all it does is it determines ackerman values through recursion
1 2 3 4 5 6 7 8 9
void acker(int m, int n, int &result)//this line cannot be modified in any way
{
if((m==0)&&(n>=0))
result = (n+1);
elseif((m>0)&&(n==0))
result=(acker(m-1, 1, result));
elseif ((m>0)&&(n>0))
result = (acker(m-1,(acker(m,(n-1), result2)), result));
}
result is then displayed not through here, but by cout right after its called
result=(acker(m-1, 1, result));
acker() does not return any value (becouse it is void) so you cannot assing it to anything. Just write acker(m-1, 1, result); and the value of result will be set inside the function. Also you cannot use it as a parameter. Line 8 should be int res2; acker(m, (n-1), res2); acker(m-1, res2, result);. Also I bet you do the same thing in your main().