Conteúdo do Curso
C++ Introduction
4. Introduction to Program Flow
5. Introduction to Functions
C++ Introduction
A Little Math
These five mathematical operators (+
, -
, *
, /
, and %
) serve to carry out various mathematical operations:
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.
main.cpp
The sum operator is the only mathematical operator that can be applied to string (that called concatenation):
main.cpp
There are also comparison operators (>
, <
, <=
, >=
). They are utilized when you need to numerically compare a value to a specific range:
main.cpp
Tudo estava claro?
Conteúdo do Curso
C++ Introduction
4. Introduction to Program Flow
5. Introduction to Functions
C++ Introduction
A Little Math
These five mathematical operators (+
, -
, *
, /
, and %
) serve to carry out various mathematical operations:
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.
main.cpp
The sum operator is the only mathematical operator that can be applied to string (that called concatenation):
main.cpp
There are also comparison operators (>
, <
, <=
, >=
). They are utilized when you need to numerically compare a value to a specific range:
main.cpp
Tudo estava claro?