<< Chapter < Page | Chapter >> Page > |
The five arithmetic assignment operators are a form of short hand. Various textbooks call them "compound assignment operators" or "combined assignment operators". Their usage can be explaned in terms of the assignment operator and the arithmetic operators. In the table we will use the variable age and you can assume that it is of integer data type.
Arithmetic assignment examples: | Equivalent code: |
age += 14; |
age = age + 14; |
age -= 14; |
age = age - 14; |
age *= 14; |
age = age * 14; |
age /= 14; |
age = age / 14; |
age %= 14; |
age = age % 14; |
Depending on your compiler/IDE, you should decide where to download and store source code files for processing. Prudence dictates that you create these folders as needed prior to downloading source code files. A suggested sub-folder for the Bloodshed Dev-C++ 5 compiler/IDE might be named:
If you have not done so, please create the folder(s) and/or sub-folder(s) as appropriate.
Download and store the following file(s) to your storage device in the appropriate folder(s). Following the methods of your compiler/IDE, compile and run the program(s). Study the soruce code file(s) in conjunction with other learning materials.
Download from Connexions: Demo_Arithmetic_Assignment.cpp
Notification Switch
Would you like to follow the 'Programming fundamentals - a modular structured approach using c++' conversation and receive update notifications?