Arithmetic Operators in C++
🟢 Beginner
📖 Definition
C++ provides standard binary arithmetic operators: addition (+), subtraction (-), multiplication (*), division (/), and modulus (% for integer remainder). Note that integer division truncates fractional decimals.
💡 Code Example
#include <iostream>
int main() {
int a = 17, b = 5;
std::cout << "a + b = " << (a + b) << "\n";
std::cout << "a / b = " << (a / b) << " (Integer truncation)\n";
std::cout << "a % b = " << (a % b) << " (Remainder)\n";
return 0;
}