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

Function main

Exercises/Modules/Chapter 12/Soln12_04/Soln12_04.cpp:5–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import integer;
4
5int main()
6{
7 std::cout << "Create i with the value 10." << std::endl;
8 Integer i {10};
9 i.show();
10 std::cout << "Change value of i to 15." << std::endl;
11 i.setValue(15);
12 i.show();
13
14 std::cout << "Create j from object i." << std::endl;
15 Integer j {i};
16 j.show();
17 std::cout << "Set value of j to 150 times that of i." << std::endl;
18 j.setValue(150 * i.getValue());
19 j.show();
20
21 std::cout << "Create k with the value 789." << std::endl;
22 Integer k {789};
23 k.show();
24 std::cout << "Set value of k to sum of i and j values." << std::endl;
25 k.setValue(i.getValue() + j.getValue());
26 k.show();
27
28 std::cout << "Result of comparing i and j is " << compare(i, j) << std::endl;
29 std::cout << "Result of comparing k and j is " << compare(k, j) << std::endl;
30}

Callers

nothing calls this directly

Calls 4

compareFunction · 0.70
showMethod · 0.45
setValueMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected