Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

C++ Program Structure · Lesson 11 of 25

Statements

A free lesson from Swipe Coding · C++, level 1 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

🤖
A semicolon is C++'s way of saying 'done with this thought.' ✅

A C++ program is made up of many small statements. A statement is a single instruction to the computer — for example "print this text" or "add these two numbers". Every statement ends with a semicolon ";".

std::cout << "Hello, C++!";
This is a single statement. It ends with a semicolon — the character that tells the compiler "this instruction is complete".
🤖
Forget this tiny character and the compiler gets confused fast. ⚠️

The semicolon works like a period at the end of a sentence: it tells the compiler "this statement is finished, the next one follows". Leave it out, and the compiler won't know where one statement ends and the next begins — it will report an error.

int main() {
    std::cout << "Hello!";
    std::cout << "How are you?";
    return 0;
}
Here are three statements in a row. C++ runs the first one, then the second, then the third — in exactly that order.
True or false

Every statement in C++ must end with a semicolon.

🤖
No shortcuts yet — C++ just runs your code top to bottom. ➡️

At its core, a C++ program is simply a sequence of statements. The processor runs them strictly in order — from top to bottom, one after another. At this stage, there are no "shortcuts" or jumps yet — it's purely step-by-step execution.

Quick check

Which character marks the end of a statement in C++?

Statements don't float around freely — they always sit inside a block enclosed by curly braces { }, such as the body of the main() function. You'll see exactly how these blocks work in the next lesson.

Fill in the blank

C++ executes a program's statements in order, from ____ to bottom.

Keep your streak going in Swipe Coding

Swipe through every level of C++ on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →