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

Function main

Exercises/NoModules/Chapter 12/Soln12_02/Soln12_02.cpp:20–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18\*****************************************************************/
19
20int main()
21{
22 std::cout << "Create i with the value 0." << std::endl;
23 Integer i;
24 i.show();
25 std::cout << "Change value of i to 15." << std::endl;
26 i.setValue(15);
27 i.show();
28
29 std::cout << "Create j from object i." << std::endl;
30 Integer j {i};
31 j.show();
32 std::cout << "Set value of j to 150 times that of i." << std::endl;
33 j.setValue(150 * i.getValue());
34 j.show();
35
36 std::cout << "Create k with the value 789." << std::endl;
37 Integer k {789};
38 k.show();
39 std::cout << "Set value of k to sum of i and j values." << std::endl;
40 k.setValue(i.getValue() + j.getValue());
41 k.show();
42
43 std::cout << "Result of comparing i and j is " << i.compare(j) << std::endl;
44 std::cout << "Result of comparing k and j is " << k.compare(j) << std::endl;
45}

Callers

nothing calls this directly

Calls 4

showMethod · 0.45
setValueMethod · 0.45
getValueMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected