← C++ Programming learning path
C++ Programming · Module 2 of 10

Variables, types and I/O

Store data and read input.

📖 Key ideas

  1. Types: int, long long, double, char, bool, std::string.
  2. Read input: std::cin >> x;
  3. auto lets the compiler deduce types.
  4. const makes values unchangeable.
  5. Type casts: static_cast<double>(x).
💡 Real-life example: Types are labelled containers: an int box holds whole numbers, a string box holds text.
intInteger type
std::cinStandard input stream
autoType deduction
static_castExplicit type conversion