At this point, we know exactly what variables are, the main types they can be, and how to declare and initialize them. We still haven’t learned to achieve much with them, however. We need to manipulate our variables, add them, take away, multiply, divide, and especially, test them.
First, we will deal with how we can manipulate them and later we will look at how and why we test them.
With this in mind, let’s learn about the C++ arithmetic and assignment operators.
C++ arithmetic and assignment operators
To manipulate variables, C++ has a range of arithmetic operators and assignment operators. Fortunately, most arithmetic and assignment operators are quite intuitive to use, and those that aren’t are quite easy to explain. To get us started, let’s look at a table of arithmetic operators followed by a table of assignment operators that we will regularly use throughout this book.