MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / main

Function main

Examples/Modules/Chapter 08/Ex8_16.cpp:7–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

powerFunction · 0.70

Tested by

no test coverage detected