Logical Operators & Short-Circuiting
🟢 Beginner
📖 Definition
Logical operators combine boolean expressions: AND (&&), OR (||), and NOT (!). C++ evaluates boolean expressions using short-circuit evaluation (skipping right-hand evaluation if the left operand determines the result).
💡 Code Example
#include <iostream>
int main() {
bool isMember = true;
int points = 120;
if (isMember && points >= 100) {
std::cout << "Eligible for reward discount!\n";
}
return 0;
}