Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

How C++ Works · Lesson 5 of 25

Source Code

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

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

🤖
Source code is just text you write — several steps turn it into something real. 📝

When you write a C++ program, you type text into a file — for example main.cpp. This human-readable text is called "source code". It follows strict, well-defined rules, but you can still read and understand it as a person.

#include <iostream>

int main() {
    std::cout << "Hello, World!";
    return 0;
}
This is C++ source code. You can read and understand it, even if you don't know every detail yet.

A computer processor cannot execute this text directly. A processor only understands "machine code" — raw instructions represented as zeros and ones, specific to its hardware. Source code is an in-between stage: readable by humans, but not yet something the hardware can run.

True or false

A computer processor can run C++ source code directly, without any translation first.

C++ source code files conventionally use the extension ".cpp" (short for "C plus plus"). Larger programs are often split into multiple .cpp files, plus "header" files (extension ".h" or ".hpp") that share declarations between them.

Fill in the blank

C++ source code files conventionally use the file extension ____.

🤖
You've got the starting point down — next up, the very first step in turning it into a program. ➡️

In summary: source code is where every C++ program begins. It's the text you write, read, and edit yourself. Turning this text into a running program takes several steps, starting with a tool called the preprocessor, which you'll meet in the next lesson.

Quick check

What best describes "source code" in C++?

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 →