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

Function main

Examples/Modules/Chapter 11/Ex11_01A/Ex11_01A.cpp:6–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import math;
5
6int main()
7{
8 std::cout << "Lambda squared: " << square(lambda) << std::endl;
9
10 int number;
11 std::cout << "\nPlease enter an odd number: ";
12 std::cin >> number;
13 std::cout << std::endl;
14
15 // if (isOdd(number)) /* Error: identifier not found: 'isOdd' */
16 // std::cout << "Well done!" << std::endl;
17
18 switch (getOddity(number))
19 {
20 using enum Oddity;
21 case Odd:
22 std::cout << "Well done! And remember: you have to be odd to be number one!";
23 break;
24 case Even:
25 std::cout << std::format("Odd, {} seems to be even?", number);
26 break;
27 }
28 std::cout << std::endl;
29}

Callers

nothing calls this directly

Calls 2

squareFunction · 0.50
getOddityFunction · 0.50

Tested by

no test coverage detected