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
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;
}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.
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.
C++ source code files conventionally use the file extension ____.
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.
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 →