Lesson 5: Order of Operations

Homework: http://beginnerscpp.com/forums/index.php/topic,59.0.html



Order of Operations
The order of operations in C++ is as follows:

  1. Parenthesis / Functions
  2. Multiplication / Division (left to right)
  3. Addition / Subtraction (left to right)

Therefore using these rules we can discern that C++ would resolve the following equation:

7+(6*3-2)*2
Would resolve to 39– 18-2 = 16*2 = 32 +7 = 39

Lesson 4: Adding on using IOManip
Lesson 6: Simple if structure