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

Function main

Exercises/NoModules/Chapter 08/Soln8_08.cpp:8–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6long double power(double x, int n);
7
8int 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
17long double power(double x, int n)

Callers

nothing calls this directly

Calls 1

powerFunction · 0.70

Tested by

no test coverage detected