recursionproblem

pls help me.. i nedd to make a program using recursion.. for example.. user will input 3+2.. the concept of recursion should be 3+1+1 and that the program will output 5.. same as in multiplication..example: input:2*3..concept of recursion:2+2+2 as well as in subtraction:ex:4-2 concept:4-1-1..output=2 and in division..input:4/2 output:2 concept:4-2-2.. pls...
this problem cannot be done using recursion as there is no sequence in the numbers
ie at first number 3 and then sequence of 1's
this problem cannot be done using recursion as there is no sequence in the numbers
ie at first number 3 and then sequence of 1's
this problem cannot be done using recursion as there is no sequence in the numbers
ie at first number 3 and then sequence of 1's
this problem cannot be done using recursion as there is no sequence in the numbers
ie at first number 3 and then sequence of 1's
@ hikarujen
don't double-post
@amit0991
don't tetra-(or is it quad-?) post

About your problem:
You could do that. That makes no sense though. Also your example abour division is broken. a/2 != 4-2-2
Try writing function add(int& number, int value) that adds 1 to number and calls add(number, value-1) if value > 0.
And another one. multiply(int& result, int number, int amount) that adds number to result while amount > 0 (the same as above).
These functions can be implemented without using references.
Topic archived. No new replies allowed.