0

I'm trying to write a function that accepts two type double parameters. The function is suppose to be calculate and return a base number raised to an exponent (using recursion), but I can't use the pow() function itself.

I've got it working fine without using decimal format numbers, but i'm stuck on what to do since both parameters accept type double.

This is what i got so far :

```
#include <iostream>
using namespace std;
double recursion (double x, double y)
{
if(y > 1)
return x * recursion(x, y - 1);
else
return x;
}
int main()
{
double base;
double exp;
cout << "(A) raised to the (B) power is ..." << endl;
cout << "Enter input (A): ";
cin >> base;
cout << "Enter input (B): ";
cin >> exp;
// Recursion call
cout << base << " raised to the " << exp <<" power is " << recursion(base, exp) << endl;
return 0;
}
```

any suggestions?