Course Content

Introduction to C++

The following five mathematical operators (`+`

, `-`

, `*`

, `/`

and `%`

) are used to perform mathematical operations:

main.cpp

The **modulo operator** (`%`

) returns the remainder of the normal division.

The **division operator** (`/`

) returns only the integer part, discarding the remainder part. For example, 10 / 3 = 3, not 3.333…
To get the expected result of division (10 / 3 = 3.333), one of the operands must be a `double`

or `float`

type:

main.cpp

The **sum operator** is the only mathematical operator the applies to string (**concatenation**):

main.cpp

There are also **comparison operators** (`>`

, `<`

, `<=`

, `>=`

). They are used if you need to compare some value with a specific range numerically:

main.cpp

15 / 4 = ?

Select the correct answer

8 % 6 = ?

Select the correct answer

Section 3.

Chapter 2