C++ : Shorthand Operator in hindi , what is Shorthand Operator in c++ language with example program

what is Shorthand Operator in c++ language with example program , C++ : Shorthand Operator in hindi :-
 इससे पहले article मे  logical operators , relational operators , bitwise operator और arithmatic operator और को discuss किया है अब इस article मे इस अभी operator को assignment operator के साथ use करने के method को  discuss किया जाता है |  इस प्रकार एक नए operator बन जाते है जिसे shorthand operator कहते है |
c++ मे operators mai bitwise operator का मुख्य भूमिका  है :-
1. Arithmatic operator
इस category मे पांच  basic arithmatic operators है जिसमे addition(+),substraction(-) , multiplication(*) , division(/), और modulas(%) है |  इन सभी operator को basic mathemetically operation के लिए किया जाता है |
2. Relation operator
जब किसी प्रोग्राम मे दो या दो से अधिक numbers अथवा वैल्यू को compare किया जाता है तब इस operator को use किया जाता है | इस category मे 5  Relation operators है |  सभी  Relation expression की value सत्य और असत्य  होती है |  इसमें larger than (>) , smaller than(<) , larger and equal than (>=) और smaller and equal than (<=) होता है | Equal than (==)operator भी reletion operator होता है  |
3. Logical Operator
ये operator का दो या दो से अधिक relation expressions को जोड़ने के लिए  किया जाता है | इसमें  logical and operator (&&) , logical Or operator (||) logical XOR operator होता है |
4. Bitwise operator
bitwise operator का use, bit level operation के लिए किया जाता है |  इसमें  And operator , Or operator , not operator , xor operator , shifting operator को include किया गया है |
Assignment Operator
Assignment operator का use किसी value या expression के आउटपुट को किसी variable के memory space पर assign करने के लिए किये जाता है  | इसका syntax (=) होता है इसका genral statement format होता है :-
int c = a+b;
इस statement मे variable ‘a’ और ‘b’ की values को add किया जाता है | इसके आउटपुट को assignment operator से variable ‘c’ मे assign किया जाता है |
इसका उदाहरण है :-
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,f;
cout<<“Enter First Value :”<<endl;
cin>>a;
cout<<“Enter Second Value :”<<endl;\
cin>>b;
c=a+b;
d=a-b;
f=a*b;
e=a/d;
cout<<” Addition Output : “<<c<endl;
cout<<” Subtraction Output : “<<d<endl;
cout<<” Multiplication Output : “<<f<<endl;
cout<<” Division Output: “<<e<<endl;
getch();
}
इस उदाहरण मे चार assignment operators को use किया गया है |
1.c = a+b;इस statement मे variable ‘a’ और ‘b’ की values को add किया जाता है | इसके आउटपुट को assignment operator से variable ‘c’ मे assign किया जाता है |
2.d=a-b;इस statement मे variable ‘a’ और ‘b’ की values को subtract किया जाता है | इसके आउटपुट को assignment operator से variable ‘d’ मे assign किया जाता है |
3.f=a*b;इस statement मे variable ‘a’ और ‘b’ की values को multiply किया जाता है | इसके आउटपुट को assignment operator से variable ‘f’ मे assign किया जाता है |
4.e=a/d;इस statement मे variable ‘a’ और ‘b’ की values को  divind किया जाता है | इसके आउटपुट को assignment operator से variable ‘e’ मे assign किया जाता है |

Shorthand Operator

जब किसी operation के आउटपुट को operation मे use किये जाने operand मे  ही store होनी होती है तब shorthand operator का use किया जाता है | इस method से statement की legth कम की जाती है |  shorthand operator को सभी मुख्य operators के साथ use किया जा सकता है | शॉट हैण्ड operator को हम मुख्य तीन category मे discuss करेगे |
1. Shorthand Opeartor with Airthmatic operator
जब किसी airthmatic operator को assignment operator के साथ combine किया जाता है | इस shorthand operator को create किया जा सकता है | इसका general format होता है :
operand 1 airthmatic operator assignment operator operand 2;
 यह पर operand 1 और operand 2 मे airthmatic operation perform होने के  बाद आउटपुट operand 1 मे assign हो जाता है |
 इसका प्रकार होते है :-
a+=b; इस statement मे , a और b को add किया जाता है | और इसके आउटपुट को ‘a’ मे assign किया जाता है | इसमें  ‘+=’ एक shorthand operator है |
a-=b; इस statement मे , b को a मे से  subtract किया जाता है | और  इसके आउटपुट को ‘a’ मे assign किया जाता है | इसमें  ‘-=’ एक shorthand operator है |
a*=b; इस statement मे , a और b को multiply किया जाता है | और इसके आउटपुट को ‘a’ मे assign किया जाता है | इसमें  ‘*=’ एक shorthand operator है |
a/=b; इस statement मे , b का a मे  भाग  दिया जाता है | और  इसके आउटपुट को ‘a’ मे assign किया जाता है | इसमें  ‘/=’ एक shorthand operator है |
इसका उदाहरण होता है :-
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
cout<<“Enter First Value :”<<endl;
cin>>a;
cout<<“Enter Second Value :”<<endl;
cin>>b;
a+=b;
cout<<” Addition Output : “<<a<endl;
a-=b;
cout<<” Subtraction Output : “<<a<endl;
a*=b;
cout<<” Multiplication Output : “<<a<<endl;
a/=b;
cout<<” Division Output: “<<a<<endl;
getch();
}
इस उदाहरण मे , यूजर द्वारा दो values को input किया जाता है | इसे variable ‘a’ और ‘b’ मे assign किया जाता है |
इसके बाद
a+=b; इस statement मे , a और b को add किया जाता है | और इसके आउटपुट को ‘a’ मे assign किया जाता है | इसमें  बाद ‘a’ की value को print कर दिया जाता है |
a-=b; इस statement मे , b को a मे से  subtract किया जाता है | और  इसके आउटपुट को ‘a’ मे assign किया जाता है | लेकिन ‘a’ की value यूजर द्वार input value नहीं होगी बल्कि ‘a’ और ‘b’ का addition होगा |
a*=b; इस statement मे , a और b को multiply किया जाता है | और इसके आउटपुट को ‘a’ मे assign किया जाता है | इसके बाद ‘a’ की value को display कर दिया जाता है |
a/=b; इस statement मे , b का a मे  भाग  दिया जाता है | और  इसके आउटपुट को ‘a’ मे assign किया जाता है |  इसके बाद ‘a’ की value display किया जाता है |
इसका आउटपुट होगा :
Enter First Value : 12
Enter Second Value : 23
Addition Output : 35
Subtraction Output : 12
Multiplication Output :276
Division Output: 1
2. Shorthand Opeartor with Bitwise Operator
जब किसी bitwise operator को assignment operator के साथ combine किया जाता है | इस shorthand operator को create किया जा सकता है | इसका general format होता है :
operand 1 bitwise operator assignment operator operand 2;
 यह पर operand 1 और operand 2 मे bitwise operation perform होने के  बाद आउटपुट operand 1 मे assign हो जाता है |
 इसका प्रकार होते है :-
a|=b; इस statement मे , a और b को  logical OR किया जाता है | और इसके आउटपुट को ‘a’ मे assign OR किया जाता है | इसमें  ‘|=’ एक shorthand operator है |
a&=b; इस statement मे , b को a मे से  Logical AND किया जाता है | और  इसके आउटपुट को ‘a’ मे assign किया जाता है | इसमें  ‘&=’ एक shorthand operator है |
a^=b; इस statement मे , a और b को  Logical XOR किया जाता है | और इसके आउटपुट को ‘a’ मे assign किया जाता है | इसमें  ‘ ^=’ एक shorthand operator है |
इसके अलावा shorthand operator को shift operator के साथ use नहीं किया जा सकता है |
इसका उदाहरण होता है :-
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
cout<<“Enter First Value :”<<endl;
cin>>a;
cout<<“Enter Second Value :”<<endl;
cin>>b;
a |=b;
cout<<” OR Operation Output : “<<a<endl;
a &=b;
cout<<” AND Operation Output : “<<a<endl;
a ^=b;
cout<<” XOR Operation Output : “<<a<<endl;
getch();
}
इस उदाहरण मे , यूजर द्वारा दो values को input किया जाता है | इसे variable ‘a’ और ‘b’ मे assign किया जाता है |
इसके बाद
a|=b; इस statement मे , a और b को OR operation perform किया जाता है | और इसके आउटपुट को ‘a’ मे assign किया जाता है | इसमें  बाद ‘a’ की value को print कर दिया जाता है |
a&=b; इस statement मे , b को a मे AND operation perform किया जाता है | और  इसके आउटपुट को ‘a’ मे assign किया जाता है | लेकिन ‘a’ की value यूजर द्वार input value नहीं होगी बल्कि ‘a’ और ‘b’ का OR operation से प्राप्त आउटपुट  होगा |
a^=b; इस statement मे , a और b को multiply किया जाता है | और इसके आउटपुट को ‘a’ मे assign किया जाता है | इसके बाद ‘a’ की value को display कर दिया जाता है |
BIT Pattern of first value 12 : 01100
BIT Pattern of first value 23 : 10111
after OR Operation :            11111 ( Equal to decimal number  : 31)
after And operation :           00100 ( Equal to decimal number  : 4)
After OR Operation :            01111 ( Equal to decimal number  : 15)
इसका आउटपुट होगा :
Enter First Value : 12
Enter Second Value :23
OR Operation Output : 31
AND Operation Output : 4
XOR Operation Output : 15
इस article मे shorthand operator को discuss किया है | अब आगे एक article मे इन सभी operators पर based उदाहरनो को discuss करेगे |