| 5 | //double power(double x, int n); // Function prototype - uncomment for successful compilation |
| 6 | |
| 7 | int main() |
| 8 | { |
| 9 | // Calculate powers of 8 from -3 to +3 |
| 10 | for (int i{ -3 }; i <= 3; ++i) |
| 11 | std::cout << std::format("{:10}", power(8.0, i)); |
| 12 | |
| 13 | std::cout << std::endl; |
| 14 | } |
| 15 | |
| 16 | // Function to calculate x to the power n |
| 17 | double power(double x, int n) |