Welcome! I'm HTMLOnline, your C++ learning companion.
We explain new ideas in plain language, practise repeatedly and build useful projects. No previous coding course is required.
Clear learning order Practise every chapter Projects and exams
C++ STARTER EXAMPLEstd::cout << "Hello, learner!\n";Your first useful result is only a few careful steps away.
Checking progress…
EXPLORE BEFORE YOU START
Learn C++ Programming from Zero: course outline
A beginner-first C++ course that grows from simple console programs to reusable classes, standard-library tools and complete projects.
10 sections · 80 chapters · 20 project chapters
Before you begin
No previous programming course is required. Begin with the first section and learn the vocabulary before moving to larger programs.
You can read this outline without signing in or completing onboarding. Start with the welcome screen above when you are ready to practise. Use a current browser; a keyboard and larger screen can make longer coding tasks easier, but the lesson interface also adapts to phones.
Practice and assessment
The in-page coding checks look for required patterns; they do not compile or execute C/C++. Use a suitable compiler to verify syntax, input, output and memory behavior. Each section combines explanations, practice, projects and a ten-question exam.
Read an explanation, study the example, try the task and review feedback. Keep your own project files and test them in their intended environment. Completing an activity or a course certificate is not an accredited qualification or a guarantee of employment.
What each section covers
Expand a section to read its chapters and projects. This is the actual course curriculum, not a separate list of promised future topics.
01Meet programming and C++8 chapters
Start from zero: understand programs, compilation, the shape of a C++ source file and readable console output.
Section outcome: Explain and write a small C++ program with clear console output.
What programs and C++ are
Understand precise instructions, the role of a programming language and why C++ is widely used.
From .cpp source to a running program
Learn what the compiler and linker do before a C++ program can run.
Practice lab: From .cpp source to a running program
Rebuild and vary the from .cpp source to a running program example until every important piece feels familiar.
Headers, main and statements
Read the structure of a small C++ program one symbol at a time.
Errors, warnings and comments
Use build messages as clues and write comments that help the next reader.
Practice lab: Errors, warnings and comments
Rebuild and vary the errors, warnings and comments example until every important piece feels familiar.
Mini project: Console profile cardProject
Create a clear multi-line introduction with C++ streams.
Unit project: Community service noticeProject
Turn a real communication need into a complete C++ console program.
02Values, types and input8 chapters
Name changing values, choose expressive types, read complete input and calculate without accidental data loss.
Section outcome: Build small interactive C++ calculators and explain every conversion.
Variables, const and meaningful names
A C++ variable is a named object with a type; const prevents changes after initialisation and communicates intent.
Numbers, bool, char and std::string
C++ provides arithmetic and Boolean types, while std::string manages text more safely and conveniently than a raw character array.
Practice lab: Numbers, bool, char and std::string
Rebuild and vary the numbers, bool, char and std::string example until every important piece feels familiar.
cin, getline and validated input
std::cin extracts formatted values, std::getline reads a whole line, and stream state reveals whether conversion succeeded.
Operators, precedence and safe conversions
Expressions follow precedence rules and type conversions; explicit casts make a deliberate conversion visible at the exact point it is needed.
Practice lab: Operators, precedence and safe conversions
Rebuild and vary the operators, precedence and safe conversions example until every important piece feels familiar.
Mini project: Shop checkoutProject
Read quantity and unit price, apply a clear tax rate and print an itemised total.
Unit project: Personal budget plannerProject
Collect labelled income and expenses, calculate the balance and warn when spending exceeds income.
03Decisions and loops8 chapters
Turn rules into branches and repeat work with traceable loop state.
Section outcome: Build menu-driven programs with validated decisions and bounded repetition.
Comparisons, logic and if branches
Comparisons create true or false conditions; logical operators combine them and if selects the matching branch.
else-if chains, switch and enum class
Ordered else-if branches handle ranges, while switch handles distinct values; enum class supplies named, scoped states.
Practice lab: else-if chains, switch and enum class
Rebuild and vary the else-if chains, switch and enum class example until every important piece feels familiar.
while, for and range-based for
while suits condition-controlled repetition, classic for suits counters, and range-based for visits every element of a collection.
Nested loops, break and continue
Nested loops process grids or combinations; break exits the nearest loop and continue skips the remainder of one iteration.
Practice lab: Nested loops, break and continue
Rebuild and vary the nested loops, break and continue example until every important piece feels familiar.
Mini project: Grade and attendance decisionProject
Combine marks, attendance and boundary rules into a transparent course result.
Unit project: Number statistics menuProject
Accept repeated values until a sentinel and report count, sum, average, minimum and maximum.
04Functions, references and overloads8 chapters
Create small interfaces with values, references, overloads, lambdas and carefully bounded recursion.
Section outcome: Organise calculations into reusable functions whose effects are explicit.
Declarations, definitions and returns
A function declaration introduces an interface, its definition implements the job and return sends a result to the caller.
Value, reference and const-reference parameters
Value parameters copy, references can modify caller-owned objects, and const references avoid a copy while preventing mutation.
Practice lab: Value, reference and const-reference parameters
Rebuild and vary the value, reference and const-reference parameters example until every important piece feels familiar.
Function overloads and default arguments
Overloads share a name across distinct parameter lists, while a default argument supplies an omitted trailing value.
Lambdas and disciplined recursion
A lambda defines a small callable near its use; recursion solves a smaller problem until a reachable base case.
Practice lab: Lambdas and disciplined recursion
Rebuild and vary the lambdas and disciplined recursion example until every important piece feels familiar.
Mini project: Conversion function libraryProject
Create and test named functions for common distance and temperature conversions.
Unit project: Function-based calculatorProject
Dispatch validated calculator operations to small functions and keep presentation separate.
05Arrays, strings and vectors8 chapters
Work with fixed and growing collections, rich text operations, iteration and standard algorithms.
Section outcome: Choose an appropriate collection and process it without unsafe bounds.
C arrays and std::array
A fixed-size array stores same-type elements; std::array adds standard container features while keeping its size part of the type.
std::string operations and text parsing
std::string owns text, reports its length, supports searching and can be combined without manual terminator management.
Practice lab: std::string operations and text parsing
Rebuild and vary the std::string operations and text parsing example until every important piece feels familiar.
std::vector and growing collections
std::vector owns a contiguous sequence that can grow, while size and capacity distinguish used elements from reserved storage.
Iterators and standard algorithms
Iterators identify positions in containers, allowing algorithms such as sort, find and accumulate to work across many container types.
Practice lab: Iterators and standard algorithms
Rebuild and vary the iterators and standard algorithms example until every important piece feels familiar.
Mini project: Word and sentence analyserProject
Measure text, count selected characters and find a word without manual memory handling.
Unit project: Marks dashboardProject
Store a growing set of marks and report sorted values, average, median, lowest and highest.
06Classes, objects and encapsulation8 chapters
Create types that protect their own state and expose small, meaningful operations.
Section outcome: Design classes with clear invariants, const queries and composed objects.
Classes, objects and member functions
A class defines a new type that combines state and operations; an object is one instance of that type.
private state and public interfaces
Encapsulation hides representation behind operations so callers cannot place an object into an invalid state directly.
Practice lab: private state and public interfaces
Rebuild and vary the private state and public interfaces example until every important piece feels familiar.
Composition and has-a relationships
Composition builds a larger type from member objects whose lifetimes belong to the containing object.
const member functions and shared class data
A const member function promises not to modify ordinary object state; static members belong to the class rather than one object.
Practice lab: const member functions and shared class data
Rebuild and vary the const member functions and shared class data example until every important piece feels familiar.
Mini project: Protected bank accountProject
Create an Account class whose public operations preserve a non-negative balance.
Unit project: Small library catalogueProject
Model books and a catalogue that can add, list and locate records without exposing its vector.
07Construction, inheritance and polymorphism8 chapters
Guest progress is saved in this browser on this device. Clearing site data or switching browsers can remove access to that local progress. An optional account can synchronize supported course progress; it is not required to access the lessons. Download or back up project work separately.
Certificates recognize completion of the course activities on this site. They are not university credit, professional accreditation or proof that every program you write is correct.