Manipulating variables

At this point we know exactly what variables are, the main types, and how to declare and initialize them, but we still can't do that much with them. We need to manipulate our variables, add them, take them away, multiply, divide, and test them.

First we will deal with how we can manipulate them and later we will look at how and why we test them.

C++ arithmetic and assignment operators

In order 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 ...

Get Beginning C++ Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.