Foundations
The parts of a C++ program, the types of its values, reading and formatting data, and how programs choose and repeat.
About 10 hours of study
Learning objectives
- Write programs that read input and print results
- Choose suitable types
- Format output neatly
- Control a program with conditions and loops
Lessons
- 1
Your first C++ program
The parts of a C++ program, printing with cout, reading with cin, and what namespaces are for.
- 2
Variables and types in C++
Store values in variables, choose among int, double, char, bool and string, use const and auto, and convert between types safely.
- 3
Input and output in depth
Read whole lines with getline, read until the input ends, and format output in columns with iomanip.
- 4
Decisions and loops
Choose with if and switch, repeat with for and while, and control a loop with break and continue.
Module practice
- C++: Greet someoneEasy
- C++: Two numbersMedium
- C++: A profile cardHard
- C++: Area of a rectangleEasy
- C++: An exact averageMedium
- C++: Counting coinsHard
- C++: A whole lineEasy
- C++: A price lineMedium
- C++: Read to the endHard
- C++: Sum of the even numbersEasy
- C++: Grades with switchMedium
- C++: A number pyramidHard