Back to Languages

Cpp Tutorial

Learn Cpp interactively. Read the concept and write code to practice.

1. C++ Introduction

C++ is a cross-platform language that can be used to create high-performance app...

2. C++ Output / Print Lines

To output values or print text in C++, you can use the `cout` object, together w...

3. C++ Variables

Variables are containers for storing data values. In C++, there are different t...

4. C++ User Input

You have already learned that `cout` is used to output (print) values. Now we wi...

5. C++ Data Types

As explained previously, a variable in C++ must be a specified data type. Basic...

6. C++ Operators

Operators are used to perform operations on variables and values. C++ divides t...

7. C++ Strings

Strings are used for storing text. A `string` variable contains a collection of ...

8. C++ Math

C++ has many functions that allows you to perform mathematical tasks on numbers....

9. C++ Conditions (If...Else)

C++ has the following conditional statements: - `if` to specify a block of code ...

10. C++ Switch

Use the `switch` statement to select one of many code blocks to be executed. ``...

11. C++ While Loop

Loops can execute a block of code as long as a specified condition is reached. ...

12. C++ For Loop

When you know exactly how many times you want to loop through a block of code, u...

13. C++ Arrays

Arrays are used to store multiple values in a single variable, instead of declar...

14. C++ References

A reference variable is a "reference" to an existing variable, and it is created...

15. C++ Functions

A function is a block of code which only runs when it is called. You can pass da...

16. Function Parameters

Information can be passed to functions as a parameter. Parameters act as variabl...

17. Classes and Objects

C++ is an object-oriented programming language. Everything in C++ is associated ...

18. Class Methods

Methods are functions that belongs to the class. There are two ways to define fu...

19. C++ Constructors

A constructor in C++ is a special method that is automatically called when an ob...

20. Inheritance & Polymorphism

Inheritance lets us inherit attributes and methods from one class to another. -...