Skip to main content
eLearner.app

End of the C++ Course

Summary and final challenge

Congratulations: you have made it through the 4 modules of the C++ Course — from your very first variables and I/O streams to classes and private member encapsulation. Below is a map of everything you have mastered and a three-step final challenge.

Reminder: C++ exercises are verified statically (keywords). To actually run the code, each exercise provides a Compiler Explorer button that copies the code and opens godbolt.org.

01 · Fundamentals

  • variables
  • data types
  • operators
  • std::cout
  • std::cin

02 · Control flow

  • if / else if / else
  • for / while / do-while loops
  • switch

03 · Functions and References

  • declaration/definition
  • return type
  • pass-by-value
  • references &

04 · OOP

  • class
  • private / public
  • constructors
  • destructors

The final challenge, in three steps

Combine what you have learned about C++ by building three small logical components: a boolean checker, an in-place modification using pass-by-reference, and a class that encapsulates a count value.

1 · Even/odd check

Write a function that accepts an integer and returns true if it is even, false otherwise. Module 1 (operators) + Module 3 (functions).

Exercise#cpp.boss.e1
Attempts: 0Loading…

Define the function isEven(int n) that returns a boolean value indicating if the passed number is even (n % 2 == 0).

Loading editor…
Show hint

Use the bool return type and the modulo operator (%). Example: return n % 2 == 0;

Solution available after 3 attempts

2 · Double and square by reference

Write a function that receives a reference to an integer and squares it directly in the original variable. Module 3 (pass-by-reference).

Exercise#cpp.boss.e2
Attempts: 0Loading…

Define the function squareByRef(int& n) that accepts a reference to an integer and calculates its square in-place, modifying the passed variable.

Loading editor…
Show hint

Use void as the return type and int& as the parameter type. Inside the function, write n = n * n;

Solution available after 3 attempts

3 · Encapsulated Counter Class

Create a class that tracks an incrementable numerical value and provides safe methods to access and modify it. Module 4 (classes and constructors).

Exercise#cpp.boss.e3
Attempts: 0Loading…

Add a constructor to the provided Counter class that initializes the private count variable to 0, a public void increment() method that increases count by 1, and a public int getCount() method that returns the current value of count.

Loading editor…
Show hint

Declare the Counter() constructor and the increment() and getCount() methods inside the public section.

Solution available after 3 attempts

Printable Cheatsheet

A single page with all the essential syntax of modern C++, ready to keep handy while you code.

Open the cheatsheet

What now?

Consistent practice is the best way to strengthen your skills. Open the C++ Playground to experiment freely with complex scenarios or to prepare your code snippets before testing them on a real compiler.