| 6 | long double power(double x, int n); |
| 7 | |
| 8 | int main() |
| 9 | { |
| 10 | for (int i {-3}; i <= 3; ++i) // Calculate powers of 8 from -3 to +3 |
| 11 | std::cout << std::setw(10) << power(8.0, i); |
| 12 | |
| 13 | std::cout << std::endl; |
| 14 | } |
| 15 | |
| 16 | // Recursive function to calculate x to the power n |
| 17 | long double power(double x, int n) |