A first course in C++, taught from first principles: types, control flow, functions, arrays, strings, vectors, pointers and references, with runnable code examples, quizzes and exercises, all in your browser.
This course takes you from your first C++ program to working directly with memory. You’ll start with how a C++ program is structured, compiled and run, then move on to variables and types, operators, input and output, control flow and functions. From there you’ll work with arrays, C-style strings, std::string, std::array and std::vector, and finish with pointers, references and the bugs they can cause, such as dangling pointers.
Object-oriented programming and the wider Standard Library are beyond the current scope, but you’ll build the foundation they rely on.
43 lessons · 16 exercises
main, Includes, NamespacesⓘUnderstand the structure of every C++ program: the main function, includes, and the std namespace.int, double, char, boolⓘLearn the four core C++ value types, int, double, char, and bool, and what it means for a language to be statically typed.constⓘLearn what literals are in C++, how their types are determined, and how to use const to declare unchangeable named values.autoⓘLearn how C++ uses auto to deduce variable types at compile time, keeping code concise without sacrificing static typing.sizeof, <limits>)ⓘUse sizeof and numeric_limits in C++ to check a type’s exact size and value range on any platform.& OperatorⓘLearn how C++ variables map to memory addresses and how to retrieve one using the & operator.std::cin and std::getlineⓘLearn to read user input in C++ using std::cin and std::getline, and handle the common pitfall of mixing the two.if, else if, else)ⓘLearn to control program flow in C++ using if, else if, and else branching logic.while and do-while LoopsⓘLearn to repeat code with C++’s while and do-while loops, and know when to use each one.for LoopⓘMaster the three-part structure of C++’s for loop, from counting and skipping to variable scope.break, continue, Nested LoopsⓘControl loop flow in C++ using break and continue, and handle nested loop exits correctly.std::string and Its MethodsⓘManipulate, search, and convert text in C++ using std::string’s built-in methods and operators.std::arrayⓘLearn to replace C-style arrays with std::array in C++ for safe indexing, size tracking, comparison, and swapping.std::vectorⓘStore, access, and iterate over resizable sequences of elements in C++ using the std::vector container.nullptrⓘUse C++ nullptr to create, check, and pass null pointers safely, and learn why it replaces NULL and 0.