Dividing numbers using recursion

So i need to write a function that divides 2 numbers and gives a remainder and a quotient using recursion, but without any loops or division or mod operator. This is what i have so far, but i need to know what to do with &quotient, and &remiander. I cant modify main() in anyway, just need to write the function.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
void divide(int dividend, int divisor, in &quotient, int &remainder)
{
if( divisor == 0 )
{
return 0;
}
else if(dividend - divisor == 0)
{
return 1;
}
else if( dividend< divisor)
{
return 0; }
else
{
return ( 1 + divide(dividend-divisor, divisor) );
}
}
int main()
{
int x,y;
divide(65,12,x,y);
return 0:
}
Topic archived. No new replies allowed.