Download presentation
Presentation is loading. Please wait.
1
Compound Operators 03/07/11
2
More Operators, First Section 4.4
3
Compound Operators Common to have variable on both sides of assignment. sum = sum + data; Compound operators allow compact code. sum += data;
4
Compound Operators variable = variable op (expression) can be written: variable op= expression
5
Compound Operators += -= *= /= %=
8
Increment and Decrement n++ ++n k-- --k Operands must be variables Change value of variables, side effect
9
Position of Increment/Decrement Where placed determines value used in the expression c = 5; cout << c++ ;cout << ++c;cout << c << endl; OUTPUT: 5 6 6 6
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.