Skip to content

Free course · 42 topics · about 75 hours

C++ Programming (modern C++ and DSA)

From your first compiled program to classes, the STL, smart pointers, C++20, threads and contest-ready DSA.

Ask or find help in C++ Programming (modern C++ and DSA)

Type a question or a word. You get the topics, explanations, meanings and quiz answers that cover it, and each result opens at the right place.

Try:

Your timeline: start to finish

About 11 weeks at 1 hour a day (75 study days) · 0/10 modules done

  1. BeginnerWeeks 1–3

    1. 4 topics · 1.7 h of lessons · ~6.1 h with practice · you are here

      📝 Module 1 exam: First steps · 12 questions

    2. 4 topics · 1.8 h of lessons · ~6.4 h with practice

      📝 Module 2 exam: Decisions, loops and functions · 12 questions

    3. 4 topics · 2 h of lessons · ~7.2 h with practice

      📝 Module 3 exam: References, pointers, arrays and strings · 12 questions

  2. IntermediateWeeks 3–8

    1. 4 topics · 1.9 h of lessons · ~6.9 h with practice

      📝 Module 4 exam: Classes, constructors and RAII · 12 questions

    2. 4 topics · 1.8 h of lessons · ~6.7 h with practice

      📝 Module 5 exam: Operators, inheritance and polymorphism · 13 questions

    3. 5 topics · 2.5 h of lessons · ~9 h with practice

      📝 Module 6 exam: The STL · 13 questions

    4. 4 topics · 2.2 h of lessons · ~7.9 h with practice

      📝 Module 7 exam: Templates, smart pointers and move semantics · 12 questions

  3. ExpertWeeks 8–11

    1. 4 topics · 1.9 h of lessons · ~7 h with practice

      📝 Module 8 exam: Modern C++ · 12 questions

    2. 4 topics · 2.2 h of lessons · ~7.9 h with practice

      📝 Module 9 exam: Exceptions, concurrency and CMake · 12 questions

    3. 5 topics · 2.5 h of lessons · ~8.9 h with practice

      📝 Module 10 exam: Contests, interviews and careers · 12 questions

  4. Final exam: C++ ProgrammingWeek 11

    38 questions · 60 min · pass 70% for the certificate

Weeks count lessons, practice, quizzes and exams (about 75 hours in all), studying every day. Go faster or slower as you like: your place is kept on this device.

0/42 topics done

Start the course →

Beginner

Weeks 1–3: compiling, variables, input and output, decisions, loops, functions, references, pointers, arrays and strings. After this level you can write and debug small C++ programs and solve simple placement-test problems.

1First steps: compiling, output, variables and input0/4 topics▼
2Decisions, loops and functions0/4 topics▼

Make programs choose with if and switch, repeat work with loops, and split code into functions with overloading, default arguments and recursion. After this module you can solve simple placement-test problems in C++.

  1. Operators and decisions: if, else and switchComparison operators (==, !=, <, >, <=, >=) give true or false, and logical operators (&&, ||, !) combine them. if / else if / else runs one branch; switch picks a case by a whole-number or character value. Never confuse = (assign) with == (compare).25 min
  2. Loops: for, while, do-while and range-forLoops repeat code. for is best when you know how many times; while repeats while a condition is true; do-while runs at least once. The range-based for loop walks over every item of a container. break leaves a loop and continue skips to the next round.25 min
  3. Functions: declare, define, call and returnA function is a named block of code with inputs (parameters) and an output (return value). In C++ you give the type of every parameter and of the result; void means "returns nothing". A declaration (prototype) tells the compiler a function exists; the definition gives its body.30 min
  4. Overloading, default arguments and recursionFunction overloading lets several functions share one name if their parameter lists differ; the compiler picks the best match. Default arguments fill in values the caller leaves out. A recursive function calls itself on a smaller problem and must have a base case that stops.25 min
📝 Module exam · 12 questions · 20 min
3References, pointers, arrays and strings0/4 topics▼

Understand how C++ stores values in memory: references and pointers, the stack and the heap, fixed arrays and std::vector, and text with std::string. After this module you can pass data to functions without copying and handle lists and text safely.

  1. References: another name for a variableA reference is a second name (an alias) for an existing variable, written with & after the type. Passing by reference lets a function change the caller's variable, and passing by const reference lets it read a big object without copying it.25 min
  2. Pointers, the stack and the heapA pointer is a variable that stores a memory address. & gives the address of a variable and * goes to the value at an address. nullptr means "points to nothing". Memory you get with new must be freed with delete, which is error-prone, so modern C++ uses containers and smart pointers instead.35 min
  3. Arrays, std::array and a first look at std::vectorAn array stores many values of one type side by side, accessed by index from 0. C-style arrays have a fixed size and no bounds checks; std::array is the safer fixed-size version; std::vector can grow and is the default choice for lists in modern C++.30 min
  4. Text: C strings and std::stringC strings are char arrays ending in a hidden '\0' character and are easy to misuse. std::string manages its own memory, grows as needed and has handy functions: size, substr, find, + and comparisons. Use std::string for text in C++, and std::to_string / std::stoi to convert numbers.30 min
📝 Module exam · 12 questions · 20 min

Intermediate

Weeks 4–7: classes and RAII, operator overloading, inheritance and polymorphism, the STL, templates, smart pointers and move semantics. After this level you can design safe classes and solve most DSA problems with the standard library.

1Classes, constructors and RAII0/4 topics▼

Bundle data and behaviour into classes, protect data with private members, set objects up with constructors and clean up with destructors, and learn RAII and the rule of zero/three/five. After this module you can design small, safe classes like a BankAccount or a Timer.

  1. Classes and objects: data plus behaviourA class is a blueprint that bundles data (member variables) with the functions that work on it (member functions). An object is one thing made from that blueprint. private members can only be used inside the class, which protects the data; public members are the class's interface.30 min
  2. Constructors and destructorsA constructor is a special member function that runs when an object is created and puts it into a valid state. Use the member initialiser list to set members. A destructor (~ClassName) runs automatically when the object is destroyed, so it is the place to release resources.30 min
  3. RAII: let objects clean up for youRAII (Resource Acquisition Is Initialisation) means: get a resource in a constructor and release it in the destructor. Because destructors always run when an object goes out of scope, even when an error is thrown, the resource can never be forgotten. std::vector, std::string, std::fstream, std::lock_guard and smart pointers all use RAII.25 min
  4. Copying objects: the rule of three, five and zeroWhen you copy an object, C++ calls its copy constructor or copy assignment operator. The compiler-made versions copy member by member, which is wrong for a raw pointer (both copies share and delete the same memory). The rule of zero says: use members that manage themselves (std::vector, std::string, smart pointers) so you need to write none of these functions.30 min
📝 Module exam · 12 questions · 20 min
2Operator overloading, inheritance and polymorphism0/4 topics▼

Give your own types natural operators like + and ==, build class families with inheritance, and call the right function at run time with virtual functions and abstract base classes. After this module you can model real systems like payment methods or shapes with clean class hierarchies.

  1. Operator overloadingOperator overloading lets your own types use operators such as +, ==, < and <<, so a Money or Fraction type reads like built-in numbers. You write a function named operator+ (and so on). Keep the meaning natural: + should add, == should compare.30 min
  2. Inheritance: building on an existing classInheritance lets a new class (derived) reuse and extend an existing class (base). It models an "is-a" relationship: a SavingsAccount is an Account. The derived class gets the base's public and protected members, and its constructor must call a base constructor.25 min
  3. Virtual functions and polymorphismA virtual function can be overridden in a derived class, and a call through a base pointer or reference runs the derived version, chosen at run time. This is polymorphism: one interface, many behaviours. Mark overrides with override, and give polymorphic base classes a virtual destructor.30 min
  4. Abstract classes, interfaces and good class designA pure virtual function (= 0) has no body in the base class, which makes the class abstract: you cannot create objects of it, only of derived classes that implement every pure virtual function. Abstract classes with only pure virtual functions act as interfaces. Combine them with composition for clean, testable designs.25 min
📝 Module exam · 13 questions · 25 min
3The Standard Template Library (STL)0/5 topics▼

Use the ready-made containers and algorithms of the C++ standard library: vector, map, unordered_map, set, stack, queue, priority_queue, iterators, sort, find and binary search, and know the cost of each operation. After this module you can pick the right container for a problem and solve most placement and contest questions with the STL.

  1. std::vector in depthstd::vector stores elements next to each other in memory and grows automatically. Adding at the end with push_back is fast (amortised O(1)), reading any index is O(1), but inserting or erasing in the middle is O(n). When a vector grows, it may move all elements, so old pointers, references and iterators to them become invalid.30 min
  2. std::map and std::unordered_mapA map stores key–value pairs, like a phone book from name to number. std::map keeps keys sorted (a balanced tree, O(log n) per operation); std::unordered_map uses hashing (O(1) on average, no order). Beware: map[key] inserts a default value when the key is missing; use find, count or contains to only check.30 min
  3. set, stack, queue, deque and priority_queuestd::set keeps unique values in sorted order and std::unordered_set keeps unique values with hashing. stack (last in, first out), queue (first in, first out) and priority_queue (largest first) are adaptors built on other containers. deque allows fast adds and removes at both ends.30 min
  4. Iterators: the glue between containers and algorithmsAn iterator is an object that points to an element of a container and can move to the next one. begin() points to the first element and end() points one PAST the last, so [begin, end) is a half-open range. Algorithms take iterator ranges, which is why one std::sort works on many containers.25 min
  5. STL algorithms: sort, find, count, accumulate and binary search<algorithm> and <numeric> give tested, fast functions that work on iterator ranges: sort, find, count, min_element, max_element, reverse, unique, accumulate, lower_bound and many more. Use them instead of hand-written loops: the code is shorter, clearer and less buggy. Custom ordering is passed as a comparison function, often a lambda.35 min
📝 Module exam · 13 questions · 25 min
4Templates, smart pointers and move semantics0/4 topics▼

Write code that works for any type with templates, own heap objects safely with unique_ptr and shared_ptr, and avoid needless copies with move semantics. After this module you can read and write the kind of modern C++ used in real codebases and explain these topics in interviews.

  1. Templates: code for any typeA template is a blueprint for a function or class with a type left as a parameter, written template <typename T>. The compiler generates a real version for each type you use, at compile time, so there is no run-time cost. The whole STL (vector<T>, map<K, V>, sort) is built from templates. C++20 concepts let you state what a type must support.35 min
  2. Smart pointers 1: std::unique_ptrstd::unique_ptr owns one heap object and deletes it automatically when the unique_ptr is destroyed (RAII for heap memory). It cannot be copied, only moved, so there is always exactly one owner. Create it with std::make_unique<T>(args), and use it as the default way to own something on the heap.30 min
  3. Smart pointers 2: std::shared_ptr and std::weak_ptrstd::shared_ptr lets several owners share one object. It keeps a reference count and deletes the object when the last shared_ptr goes away. It costs more than unique_ptr, so use it only when ownership is truly shared. std::weak_ptr watches a shared object without owning it, which breaks reference cycles.30 min
  4. Move semantics: steal instead of copyMoving transfers the insides (like a heap buffer) from one object to another instead of copying them, which makes passing and returning big objects cheap. Temporary values (rvalues) are moved automatically; std::move marks a named object as "you may move from me". After a move, the source is valid but its value is unspecified.35 min
📝 Module exam · 12 questions · 25 min

Expert

Weeks 8–11: modern C++17/20, exceptions, concurrency, CMake, competitive programming, interviews and careers. After this level you can build and debug a real multi-file C++ project and face C++ interviews with confidence.

1Modern C++: lambdas, C++17 and C++20 essentials0/4 topics▼

Write short, clear modern C++: lambdas and captures, auto and structured bindings, std::optional, std::variant and std::string_view, and C++20 ranges and views. After this module your code looks like the C++ written in companies today, not like C++ from the 1990s.

  1. Lambdas: small functions written in placeA lambda is an unnamed function you write right where you need it, often as the comparison for std::sort or the condition for std::count_if. The capture list [ ] says which outside variables it can use: [=] copies, [&] refers, or name them one by one. Be careful with [&] when the lambda outlives the variables.30 min
  2. auto, structured bindings and other C++17 conveniencesauto lets the compiler deduce a variable's type from its initial value. Structured bindings (auto [a, b] = pair;) unpack pairs, tuples and structs into named variables. C++17 also added if and switch with an initialiser, [[nodiscard]], inline variables and constexpr if.25 min
  3. std::optional, std::variant and std::string_viewstd::optional<T> holds either a T or nothing, which is a clear way to say "no result" without magic values like -1. std::variant<A, B> holds exactly one of several types, safely. std::string_view is a cheap, read-only view of text owned by someone else. All three arrived in C++17.30 min
  4. C++20 ranges, views and other C++20 essentialsC++20 ranges let algorithms take a whole container (std::ranges::sort(v)) and add views: lazy, composable steps like filter and transform, joined with the | pipe. C++20 also brought concepts, std::span, designated initialisers, the spaceship operator, std::format and modules. Check your compiler's support for each feature.30 min
📝 Module exam · 12 questions · 25 min
2Exceptions, concurrency and building projects with CMake0/4 topics▼

Handle errors with exceptions and noexcept, run work in parallel with threads, mutexes, atomics and futures without data races, and build multi-file projects with CMake, warnings and sanitizers. After this module you can structure, build and debug a real C++ project the way teams do.

  1. Exceptions: throw, try, catch and noexceptAn exception reports an error that the current function cannot handle: you throw it, and the nearest matching catch block up the call stack handles it. Local objects are destroyed on the way (stack unwinding), so RAII keeps resources safe. Throw standard exception types by value and catch them by const reference.30 min
  2. Concurrency 1: threads, mutexes and data racesA thread is a separate path of execution that runs at the same time as others, using more CPU cores. std::thread (and C++20 std::jthread) starts one. When threads share data and at least one writes, you must protect it with a std::mutex (via std::lock_guard or std::scoped_lock); otherwise you have a data race, which is undefined behaviour.35 min
  3. Concurrency 2: atomics, async, futures and condition variablesstd::atomic<T> makes simple shared values like counters and flags safe without a mutex. std::async runs a function, possibly on another thread, and gives a std::future you can later .get() the result from (exceptions travel too). std::condition_variable lets a thread sleep until another thread signals that something is ready.30 min
  4. Building real projects: CMake, warnings, debuggers and sanitizersReal C++ projects have many files and libraries, so teams describe the build in CMake (a CMakeLists.txt file) instead of typing long g++ commands. CMake generates build files for Make, Ninja or Visual Studio. Combine it with warnings, a debugger (gdb, lldb or Visual Studio), sanitizers and a formatter to work like a professional.35 min
📝 Module exam · 12 questions · 25 min
3Competitive programming, interviews and careers0/5 topics▼

Use C++ for contests and coding rounds: a fast template, time-limit maths, the core DSA patterns, the classic C++ pitfalls, the C++ questions interviewers ask, and the jobs C++ leads to. After this module you can practise on online judges with confidence and prepare for C++ interviews.

  1. Competitive programming with C++: setup and time limitsContest sites (Codeforces, CodeChef, AtCoder, LeetCode, CSES) give a problem, input limits and a time limit, usually 1–2 seconds. C++ is popular because it is fast and the STL has ready-made data structures. Read the limits first: they tell you which time complexity your solution needs.30 min
  2. Core DSA patterns in C++A handful of patterns solve a large share of placement and contest problems: prefix sums, two pointers, binary search (including on the answer), hashing with maps and sets, BFS and DFS on graphs, and simple dynamic programming. Learn each pattern with its C++ STL tools and its time complexity.40 min
  3. Classic C++ pitfalls in contests and coding roundsMost Wrong Answers in C++ come from a few traps: integer overflow, wrong use of unsigned size(), uninitialised variables, reading outside arrays, slow I/O with endl, deep recursion, and comparing floating-point numbers with ==. Knowing them saves hours.25 min
  4. C++ interview questions and how to answer themC++ interviews mix DSA coding with language questions: pointers versus references, the virtual function mechanism, RAII and smart pointers, the rule of three/five/zero, move semantics, const, the STL's complexities and undefined behaviour. Answer with a one-line definition, a tiny example and when you would use it.35 min
  5. Careers with C++ and your next stepsC++ jobs are in game development, embedded and automotive software, browsers and operating systems, databases, trading systems, telecom and high-performance computing. Fresher pay in India varies widely; most roles start around ₹4–10 LPA, with a small number of very selective firms paying much more. A portfolio of 2–3 solid projects plus good DSA skills is the best way in.20 min
📝 Module exam · 12 questions · 20 min

🎓 Final exam and certificate

38 questions, 60 minutes, pass mark 70%. Pass it to get a certificate with your name.