OPERATORS(+,-,*,/,%)(Операторы)


Operators(Операторы)

Operators မ်ားသည္ programming language မ်ားတြင္ operate ၿပဳလုပ္ရန္အေၿခခံအက်ဆံုးၿဖစ္သည္။ ကၽြန္ေတာ္တို႕သည္ operator မ်ား၏လုပ္ေဆာင္မွဳ႕ဆိုင္ရာမ်ားအား တိက်စြာ နားလည္မွဳ႕ရွိမွသာ program မ်ားအားတိက်စြာ operate ၿပဳလုပ္နိဳင္မည္ၿဖစ္သည္။
Operators မ်ားအား အေၿခခံအားၿဖင့္ (၅) မ်ိဳးခြဲၿခားေလ့ရွိသည္။

1.Arithmetic operators( + - * / % )(Арифметические операторы)
Arithmetic operators မ်ားသည္ mathematical ဆိုင္ရာ ကိန္းဂဏန္းမ်ားတြက္ခ်က္ရာတြင္အဓိကထား၍ အသံုးၿပဳၾကသည္။
+
           addition
_
          subtraction
*
          multiplication
/
          division
%
          modulo

#include<iostream>
usingnamespace std;
int main()
{  cout<<5 + 2<<endl;       // 7
   cout<<10 - 3<<endl;       // 7
   cout<<25 * 5<<endl;      //125
   cout<<9 / 5<<endl;        // 1
   cout<<9 % 5<<endl;      // 4
   cout<<9 / 5.0<<endl;     //1.8
   return 0;
}


2.Relational operators(операторы отношения)
Relational operators မ်ားအား mathematical ဆိုင္ရာ ကိန္းဂဏန္းမ်ား ႏွင့္ ၎တို႕အားႏွိဳင္းယွဥ္ရန္အတြက္ အဓိကထား၍အသံုးၿပဳၾကသည္။

Less than
<=
Less than or equal to
Greater than
>=
Greater than or equal to
==
Equal to
!=
Not equal to

3. Logical and bitwise operators(Логические и побитовые операторы)
Logical operator မ်ားသည္ အမ်ိဳးမ်ိဳးေသာ condition(အေၿခအေန) မ်ားအား ေပါင္းစပ္ရန္လိုအပ္ေသာ အေၿခအေနမ်ိဳးတြင္ အဓိကထား၍ အသံုးၿပဳၾကသည္။
………………………………………………………………………….
bitwise operators မ်ားသည္ digits (bits) မ်ားၿဖင့္အလုပ္လုပ္ေသာ operators မ်ားၿဖစ္ၿပီး float နွင့္ double ကဲ့သို႕ေသာ variable မ်ားနွင့္ operate လုပ္နိဳင္မည္မဟုတ္ေပ။

&
Bitwise  "AND" 
|
Bitwise  "OR”
 ~
Bitwise  “inversion”
^
Bitwise  "exclusive OR"
<< 
Shift  left
>> 
Shift  right

4.Increment and Decreament operators(Операторы инкремента и декремента)
C++ Language တြင္ mathematics operations မ်ားတြင္မေတြ႕ရေသာ operators နွစ္မ်ိဳးရွိသည္။၎ operators ႏွစ္မ်ိဳးမွာ ++(increament) ႏွင့္ --(decreament) ပင္ၿဖစ္သည္။Increament operation တြင္ operand ဆီသို႕ ၁ ေပါင္းထည့္မည္ၿဖစ္ၿပီး decreament operation တြင္ operand ဆီမွ ၁ ႏွဳတ္မည္ၿဖစ္သည္။
i++ သည္ i+1 နွင့္တူညီမည္ၿဖစ္သည္။
i-- သည္ i-1 နွင့္ တူညီမည္ၿဖစ္သည္။
သို႕ရာတြင္ i++ ႏွင့္ i-- တို႕သည္ ++ , -- စသည့္ sign မ်ား တည္ရွိသည့္ေနရာေပၚတြင္မူတည္၍ အဓိပါယ္အနည္းငယ္ကြာၿခားမည္ၿဖစ္သည္။
a=b++ သည္ ပထမဦးစြာ a သည္ b နွင့္တူညီမည္ၿဖစ္ၿပီး ထို႕ေနာက္တြင္မွ b ကိုတစ္ခုတိုးမည္ၿဖစ္သည္။
a=++b သည္ ပထမဦးစြာ b ကိုတစ္ခုတိုးမည္ၿဖစ္ၿပီး ထို႕ေနာက္တြင္မွ a သည္b နွင့္တူညီမည္ၿဖစ္သည္။

#include <iostream>
using namespace std;
int main()
{  int i=15;
cout<<i<<endl;                 // 15
cout<<++i<<endl;            // 16
cout<<i<<endl;                 // 16
cout<<i++<<endl;            // 16
cout<<i<<endl;                 // 17
return 0;
}

5.Assignment operators(операторы присваивания)
Operation တစ္ခုတြင္ လက္ရွိအသံုးၿပဳေနေသာ variable တစ္ခု၏ တန္ဖိုးအား ထို variable ေပၚတြင္ရွိေသာ တန္ဖိုးၿဖင့္ modify ၿပဳလုပ္လိုေသာအခါတြင္ coumound assignment operators အားအသံုးၿပဳသည္။အဓိက အားၿဖင့္ ပရိုဂမ္အား အတိုေရးသားရန္လည္း အသံုးၿပဳသည္ ၿဖစ္သည္။ 
ဥပမာ a=a+25 ဆိုလွ်င္ ထပ္မံ၍ a ဆိုသည့္ variable ပါ၀င္ေသာေၾကာင့္ ၎တို႕သည္ address တစ္ခု တည္း ၿဖစ္ေသာေၾကာင့္ ၎အား a=+25 ဟုေရးသားနိဳင္သည္။
assignment operator တြင္ အသံုးမ်ားေသာ assign မ်ားမွာ
 *=, /=, +=, -=, %=, <<= ,>>=, &=, ^=, |=  တို႕ၿဖစ္ၾကသည္။

အထက္ေဖာ္ၿပပါ operators မ်ားအၿပင္ အနည္းငယ္အသံုးမ်ား operators မ်ားအားေအာက္ပါအတိုင္း ေတြ႕ရွိနိဳင္သည္။
conditonal operator(?)
comma operator(,)
sizeof()

/*ပထမတြင္ ေဖာ္ၿပခဲ့ေသာ operator (၅) မ်ိဳးသည္မၿဖစ္မေန သိရမည့္ operators မ်ားၿဖစ္သည္။ */
  
written by miet51

1 comment: