course content

Course Content

C++ Introduction

A Little MathA Little Math

These five mathematical operators (+, -, *, /, and %) serve to carry out various mathematical operations:

cpp

main.cpp

The modulo operator (%) calculates and returns the remainder resulting from a standard division operation.

The division operator (/) returns only the integer part of the result, discarding any remainder. For instance, when dividing 10 by 3, the result is 3, not 3.333... To obtain the desired division result with decimals (e.g., 10 / 3 = 3.333), it is necessary for at least one of the operands to be of a double or float data type.

cpp

main.cpp

The sum operator is the only mathematical operator that can be applied to string (that called concatenation):

cpp

main.cpp

There are also comparison operators (>, <, <=, >=). They are utilized when you need to numerically compare a value to a specific range:

cpp

main.cpp

1. What will be the output of the code:
2. What will be the output of the code:

question-icon

What will be the output of the code:

Select the correct answer

question-icon

What will be the output of the code:

Select the correct answer

Everything was clear?

Section 3. Chapter 2