Operators are the verbs of the language: they add, compare, flip and combine the values you store.
1 Arithmetic
+, -, * and / do the math you expect; % keeps only the remainder — 17 % 5 is 2.
2 Integer division
When both sides are ints, / throws the fraction away: 17 / 5 is 3, not 3.4.
3 Compound shortcuts
a += 3 grows a in place, b-- shrinks b by one — same math, less typing.
4 Comparisons
==, !=, <, <=, > and >= ask a question and answer 1 (true) or 0 (false).
5 Logic glue
&& demands both sides true, || accepts one, ! flips a condition upside down.
The verb set of C++
Arithmetic1+, -, * and / do the math you expect; % keeps only the remainder — 17 % 5 is 2.
Integer division2When both sides are ints, / throws the fraction away: 17 / 5 is 3, not 3.4. Compound shortcuts3a += 3 grows a in place, b-- shrinks b by one — same math, less typing.
Comparisons4==, !=, <, <=, > and >= ask a question and answer 1 (true) or 0 (false). Logic glue5&& demands both sides true, || accepts one, ! flips a condition upside down.
5 building blocks make up The verb set of C++
One line can hold several operators — press Run to see the order C++ evaluates them in.
Press play — five cout lines, five different operators, one tiny program.
preprocessThe preprocessor pastes in iostream — cout lives there.
Memory
no variables yet — press play
Console
output appears as the program runs…
Click an operator, then click the description that fits it.
5 conceptsTap a card to expand ?++drops into place
?==drops into place
?&&drops into place
?/=drops into place
An age check: age >= 13 && age <= 18. Each comparison produces 1 or 0, and && demands both.
process decision input / output start / end Division, remainder, increment and a comparison — four lines, four surprises.
Your predicted output — one line per console line
Hint: Both x and y are ints, so / truncates. Then x becomes 8 and y becomes 2 + 8.
01/ between two ints truncates: 17 / 5 is 3 — reach for % when you need the leftover 2.
02++ adds one, += adds any amount — both update the variable in place.
03== compares, = assigns. Mixing them up is the classic beginner bug.
04Precedence: * / % before + -, equal ranks left to right, parentheses always win.
05Comparisons and && / || / ! build the conditions every if and loop will run on.