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

Function main

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

Source from the content-addressed store, hash-verified

5//double power(double x, int n); // Function prototype - uncomment for successful compilation
6
7int 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
17double power(double x, int n)

Callers

nothing calls this directly

Calls 1

powerFunction · 0.70

Tested by

no test coverage detected