## Break Time — Dice Wars

Even though this site is focused on programming, it’s always good to take a break every once in a while. Get up, stretch, and refocus your mind on something else for a few minutes. We all like to have a little bit of fun, and one of the best ways …

## 4.8 — Floating point numbers

Integers are great for counting whole numbers, but sometimes we need to store very large (positive or negative) numbers, or numbers with a fractional component. A floating point type variable is a variable that can hold a number with a fractional component, such as 4320.0, -3.33, or 0.01226. The floating …

## 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 primary fundamental integer types available for use: The key difference between the various integer types is that they have varying sizes — the larger integers can …

## 4.3 — Object sizes and the sizeof operator

Object sizes As you learned in the lesson , memory on modern machines is typically organized into byte-sized units, with each byte of memory having a unique address. Up to this point, it has been useful to think of memory as a bunch of cubbyholes or mailboxes where we can …

## 1.10 — Introduction to expressions

Expressions Consider the following series of statements: // five() is a function that returns the value 5 int five() { return 5; } int main() { int a{ 2 }; // initialize variable a with literal value 2 int b{ 2 + 3 }; // initialize variable b with computed …

## 1.7 — Keywords and naming identifiers

C++ reserves a set of 92 words (as of C++23) for its own use. These words are called keywords (or reserved words), and each of these keywords has a special meaning within the C++ language. Here is a list of all the C++ keywords (through C++23): alignas alignof and and_eq …

## Introduction to Roguelike gaming

I play many different kinds of video games, but Roguelike games are some of my favorites. Before I go into the why, let me introduce Roguelike games to those of you who are not familiar with them. The Roguelike game genre was created all the way back in 1980 when …

## 4.1 — Introduction to fundamental data types

In lesson , we talked about the fact that variables are names for a piece of memory that can be used to store information. To recap briefly, computers have random access memory (RAM) that is available for programs to use. When a variable is defined, a piece of that memory …

## 1.x — Chapter 1 summary and quiz

A is a type of instruction that causes the program to perform some action. Statements are often terminated by a semicolon. A is a collection of statements that execute sequentially. Every C++ program must include a special function named main. When you run your program, execution starts at the top …

## 2.10 — Introduction to the preprocessor

When you compile your project, you might expect that the compiler compiles each code file exactly as you’ve written it. This actually isn’t the case. Instead, prior to compilation, each code (.cpp) file goes through a phase. In this phase, a program called the makes various changes to the text …