Topics 3 – 7 (Operators to Arrays)
Topic 3: Operators in C++
An operator performs an operation on one or more values (called operands).
✎Types of Operators
Type Symbols Example
Arithmetic + - * / % a + b, a % b
Relational == != > < >= <= a == b
Logical && || ! a>0 && b>0
Assignment = += -= *= /= a += 5
Increment/Decrement ++ -- a++, --b
✎Example
int a = 10, b = 3;
cout << a + b; // 13
cout << a % b; // 1 (remainder)
cout << (a > b); // 1 (true)
★ Remember: % (modulus) only works with integers, not float/double.
Topic 4: Control Statements (if-else, switch)
Control statements decide which block of code runs, based on a condition.
✎if / else if / else
if (marks >= 90) {
cout << "Grade A";
} else if (marks >= 70) {