Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 989 Bytes

File metadata and controls

28 lines (20 loc) · 989 Bytes

C++ fundamentals notes

Program shape

Execution begins in main. Returning zero conventionally reports success to the calling environment. Standard output is observable behavior, so these examples test it rather than only checking compilation.

Constants

constexpr marks a value intended to be usable at compile time. It is suitable for the example age and price because neither changes while the program runs. The kExample... names also make clear that these are sample values, not personal data.

Loop boundaries

The counting example uses value <= 5, so the inclusive upper bound is visible. It writes a separator before each value after the first, avoiding a trailing space. This is a small example of turning output requirements into control flow.

Questions to revisit

  • compilation phases and linker errors;
  • signed/unsigned conversions;
  • object lifetime and ownership;
  • stream failure states;
  • when exact text output is too brittle for a useful test.