Operator ဆိုတာ value တွေကို တွက်ချက်၊ နှိုင်းယှဉ်၊ condition စစ်ဖို့ သုံးတဲ့ symbol တွေပါ။ Calculator သုံးသလိုပဲ ဖြစ်ပေမယ့် programming မှာ operator priority နဲ့ data type effect တွေကို သတိထားရပါတယ်။
cpp
#include <iostream>
using namespace std;
int main() {
int x = 10;
int y = 3;
cout << "Sum: " << x + y << endl;
cout << "Remainder: " << x % y << endl;
cout << "Is x greater? " << (x > y) << endl;
x += 5;
cout << "Updated x: " << x;
return 0;
}+ ကပေါင်းတာ၊ % က remainder ရှာတာ၊ > က နှိုင်းယှဉ်တာ၊ += က လက်ရှိ value ထဲကို ထပ်ပေါင်းတာပါ။ (x > y) ရဲ့ result က true ဖြစ်လို့ console မှာ 1 ထွက်ပါတယ်။
You should see
Sum: 13 Remainder: 1 Is x greater? 1 Updated x: 15Info
/ ကို integer နှစ်ခုနဲ့သုံးရင် integer division ဖြစ်နိုင်ပါတယ်။ Decimal result လိုချင်ရင် value တစ်ခုကို double ဖြစ်အောင်လုပ်ပါ။