0

```
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
double power(double b, double p);
void main(void){
int base = 0, power = 0, result = 0;
cout << "Programmed by ." << endl << endl;
cin >> base;
cout << " ^ ";
cin >> power;
result = power(base, power);
}
double power(double b, double p){
//b = base, p = power
double equation, result;
if (p == 1){
return b;
}
if (int(p) % 2 == 0){
// (b^2)^(p/2)
equation = (pow(pow(b, 2), (p / 2)));
result = equation * power(b, p - 1);
}
if (int(p) % 2 == 1){
// b * (b^2)^((p-1)/2)
equation = b * (pow(pow(b, 2), ((p - 1) / 2)));
result = equation * power(b, p - 1);
}
}
```

Think its self explanatory on what its supposed to do, but i dont know how to return to main, because its being called from the function by the time it reaches the return value. Some help would be greatly appreciated!