Introduction to C++
C++ is a compiled, statically-typed language that gives you direct control over memory and hardware while still supporting high-level object-oriented design. It powers game engines, operating systems, embedded devices, and performance-critical backend systems.
Why Learn C++?
C++ was created by Bjarne Stroustrup in the early 1980s as an extension of the C language, adding object-oriented features while keeping C's speed and low-level access. Decades later it remains one of the most in-demand languages for systems programming, game development, and high-frequency applications.
Unlike interpreted languages, C++ is compiled directly to machine code, which is why it is consistently among the fastest general-purpose languages available. Learning it also builds a strong mental model of memory, pointers, and how computers actually execute programs — knowledge that transfers to almost every other language.
- Game engines — Unreal Engine and most AAA game studios build on C++.
- Operating systems — parts of Windows, Linux drivers, and macOS internals use C/C++.
- Finance — trading systems where microseconds matter rely on C++.
- Embedded systems — microcontrollers and IoT devices with limited resources.
Your First Program
Every C++ program needs an entry point called main(). The program below prints a greeting to the console using the standard input/output stream library.
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
Common Mistakes
- Forgetting the
#includedirective for a library you are using, such as<iostream>. - Missing the semicolon at the end of a statement — C++ requires one after almost every line.
- Forgetting
return 0;at the end ofmain()(most compilers allow it, but it is good practice). - Confusing
std::coutwithstd::cin— one outputs, the other reads input.
Professional Tip
C++ compiles your source code directly into an executable specific to your operating system and processor architecture. This is why a compiled C++ program runs so fast — there is no interpreter translating instructions at runtime.
Your Turn
Install a C++ compiler (covered in the next lesson) and write a program that prints your name, the course you are studying, and today's date on three separate lines using three std::cout statements.
Mini Quiz
What is the entry point function that every C++ program must have?
main(). The operating system looks for this function when it launches your compiled program.