C++ Syntax:Arithmetic: + - * / %
Description
The C++ arithmetic operators + - / and * are just as in FORTRAN
There is no exponentiation operator **, instead do:-
exp(x)
which requires the
header file
#include <math.h>
% is the modulo
operator, for example:-
5 % 3
is 2.
See operator
precedence
Other Uses for + - * / %
- As with other binary operators, the arithmetic operators
can be combined with
=
for example:-
remainder %= divisor;
- * can also be the derefernce operator
Usage Notes
None.
Go Back to the
The C++ Crib Top Page
If you have any comments about this page please send them to
Nick West