4.14 — Literal constants

In programming, a is a fixed value that may not be changed. C++ has two kinds of constants: literal constants, and symbolic constants. We’ll cover literal constants in this lesson, and symbolic constants in the next lesson (). (usually just called ) are unnamed values inserted directly into the code. …

4.11 — Chars

To this point, the fundamental data types we’ve looked at have been used to hold numbers (integers and floating point) or true/false values (booleans). But what if we want to store letters or punctuation? #include <iostream> int main() { std::cout << “Would you like a burrito? (y/n)”; // We want …

4.9 — Boolean values

In real-life, it’s common to ask or be asked questions that can be answered with “yes” or “no”. “Is an apple a fruit?” Yes. “Do you like asparagus?” No. Now consider a similar statement that can be answered with a “true” or “false”: “Apples are a fruit”. It’s clearly true. …

4.4 — Signed integers

An is an integral type that can represent positive and negative whole numbers, including 0 (e.g. -2, -1, 0, 1, 2). C++ has 4 different fundamental integer types available for use: The key difference between the various integer types is that they have varying sizes — the larger integers can …