Operators#
Introduction#
Operators in C++ are symbols that let you perform operations on variables and values. They include arithmetic, logical, comparison, assignment, and bitwise operators. C++ also supports increment/decrement, conditional expressions, and compound assignment. These form the core of most logic and math in any C++ program, including robotics control with VEXcode IQ (2nd gen).
Arithmetic#
Name |
Symbol |
Operator |
Example |
---|---|---|---|
Addition |
|
|
|
Subtraction |
|
|
|
Multiplication |
|
|
|
Division |
|
|
|
Modulo |
|
|
|
Negation |
|
|
|
Augmented Arithmetic#
Name |
Symbol |
Operator |
Example |
---|---|---|---|
Addition |
|
|
|
Subtraction |
|
|
|
Multiplication |
|
|
|
Division |
|
|
|
Modulo |
|
|
|
Comparison#
Name |
Symbol |
Operator |
Example |
---|---|---|---|
Equality |
|
|
|
Inequality |
|
|
|
Greater Than |
|
|
|
Less Than |
|
|
|
Greater Than or Equal |
|
|
|
Less Than or Equal |
|
|
|
Logical#
Name |
Symbol |
Operator |
Example |
---|---|---|---|
Logical AND |
|
|
|
Logical OR |
|
|
|
Logical NOT |
|
|
|
Assignment#
Name |
Symbol |
Operator |
Example |
---|---|---|---|
Assignment |
|
|
|
Bitwise#
Name |
Symbol |
Operator |
Example |
---|---|---|---|
Bitwise AND |
|
|
|
Bitwise OR |
|
|
|
Bitwise XOR |
|
|
|
Bitwise NOT |
|
|
|
Left Shift |
|
|
|
Right Shift |
|
|
|
Augmented Bitwise#
Name |
Symbol |
Operator |
Example |
---|---|---|---|
Bitwise AND |
|
|
|
Bitwise OR |
|
|
|
Bitwise XOR |
|
|
|
Left Shift |
|
|
|
Right Shift |
|
|
|
Ternary (Conditional)#
Name |
Syntax |
Example |
---|---|---|
Conditional Operator |
|
|
Increment / Decrement#
Name |
Symbol |
Operator |
Example |
---|---|---|---|
Pre-Increment |
|
|
|
Post-Increment |
|
|
|
Pre-Decrement |
|
|
|
Post-Decrement |
|
|
|