C++ : Logical Operator in hindi , Equal than , Logical OR , AND , XOR Operators in c++ language

Logical OR , AND , XOR Operators in c++ language , C++ : Logical Operator in hindi , Equal than :-
 इससे पहले एक article मे c++ मे उपस्थित सभी data type को discuss कर लिए है लेकिन केवल arithmetic operator or relational operator को discuss किया है | अब इस article मे  logical operator को discuss करेगे |Relation Operator
c++ मे operators को basically तीन प्रकार से divind किया जाता है :-
1. arithmatic operator
इस category मे पांच  arithmatic operators है जिसमे addition,substraction , multiplication , division, और modulas है | इस सभी operator को basic arithmatic operation मे use किया जाता है | इन सभी को हम पहले अच्छी तरह से discuss कर चुके है |
2. Relation operator
जब किसी प्रोग्राम मे दो या दो से अधिक values को compare किया जाता है तब इस operator को use किया जाता है | इस category मे पांच  Relation operator है | जब किसी expression मे Relation operator को use किया जाता है तब इसे Relation expression कहते है | सभी  Relation expression की value boolean होती है | अथात इसकी true और false value होती है | इसमें larger than , smaller than , larger and equal than और smaller and equal than होता है |

1. Equal than
इस operator का use किसी  दो values मे compare करने के लिए use किया जाता है | इसका syntax ‘==’ होता है | इसमें first == second statement से मतलब होता है first value का compare second value से होता है | अगर first value , second value से समान होती तब इस expression का आउटपुट ‘1’ होता है  अन्यथा ‘0’ होती है |
इसका उदाहरण होता है :-
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
bool t;
cout<<“Enter First Value :”<<endl;
cin>>a;
cout<<“Enter Second Value :”<<endl;
cin>>b;
t=(a==b);
if(b=’TRUE’)
{
cout<<“Both values are same .” <<endl;
}
else
cout<<“Both values are not same . “<<endl;
getch();
}
इस उदाहरण मे दो variable को declare किया जाता है | जिसको variable ‘a’ और ‘b’ मे assign कर दिया जाता है |
और (a==b) expression के आउटपुट को variable  t मे assign कर देते है | इस variable का type boolean है |
अगर variable ‘t’ की value ‘1’ होती है तब Largest value :a print होगा |
अन्यथा  Largest value :  b display होता है |
इसका आउटपुट होगा
Enter First Value : 12
Enter Second Value : 23
Both values are not same.

2. Logical Or
जब किसी दो reletion sttement को एक साथ test किया जाता है | तब इस logical operator का use किया जाता है | इसका syntax “||” है | अगर दोनों reletion statement का आउटपुट true होता है  तब  इस expression का आउटपुट भी ‘1’ होगा |
इसका truth tabel होता है |
अगर input a = 1 or int b= 1 than output 1 होता है |
अगर input a = 1 or int b= 0 than output 0 होता है |
अगर input a = 0 or int b= 1 than output 0 होता है |
अगर input a = 0 or int b= 0 than output 0 होता है |
इसका उदाहरण होता है :-
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
bool t;
cout<<“Enter First Value :”<<endl;
cin>>a;
cout<<“Enter Second Value :”<<endl;
cin>>b;
t=(a<b || a>b);
if(b=’TRUE’)
{
cout<<“Both values are same .” <<endl;
}
else
cout<<“Both values are not same . “<<endl;
getch();
}
इस उदाहरण मे दो variable को declare किया जाता है | जिसको variable ‘a’ और ‘b’ मे assign कर दिया जाता है |
और (a<b || a>b) expression के आउटपुट को variable  t मे assign कर देते है | इस variable का type boolean है |
अगर variable ‘t’ की value ‘1’ होती है तब Both values are same .print होगा |
अन्यथा  Both values are not same. display होता है |
इसका आउटपुट होगा
Enter First Value : 12
Enter Second Value : 23
Both values are not same .

2. Logical AND
जब किसी दो reletion sttement को एक साथ test किया जाता है | तब इस logical operator का use किया जाता है | इसका syntax “&&” है | अगर दोनों reletion statement का आउटपुट false होता है  तब  इस expression का आउटपुट भी ‘false’ होगा | अगसर कोई एक statement true होता है तब  expression का आउटपुट ‘1’ होगा |
इसका truth tabel होता है |
अगर input a = 1 or int b= 1 than output 1 होता है |
अगर input a = 1 or int b= 0 than output 1 होता है |
अगर input a = 0 or int b= 1 than output 1 होता है |
अगर input a = 0 or int b= 0 than output 0 होता है |
इसका उदाहरण होता है :-
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
cout<<“Enter First Value :”<<endl;
cin>>a;
cout<<“Enter Second Value :”<<endl;
cin>>b;
cout<<“Enter Third Value :”<<endl;
cin>>c;
if (a>b && b>c )
{
cout<<“a is larger among than all three.”;
}
if (a>b && b>c )
{
cout<<“a is larger among than all three.”;
}
if (b>a && a>c )
{
cout<<“b is larger among than all three.”;
}
cout<<“c is larger among than all three.”;
getch();
}
इस उदाहरण मे दो variable को declare किया जाता है | जिसको variable ‘a’ और ‘b’ मे assign कर दिया जाता है |
और (a>b && b>c ) expression के आउटपुट true hota है | तब  a is larger among than all three. display होगा |
अगर b>a && a>c ) की value ‘1’ होती है तब b is larger among than all three. print होगा |
अन्यथा  c is larger among than all three. display होता है |
इसका आउटपुट होगा
Enter First Value : 12
Enter Second Value : 23
Enter Third Value : 32
c is larger among than all three.

4. Logical Xor
जब किसी दो reletion sttement को एक साथ test किया जाता है | तब इस logical operator का use किया जाता है | इसका syntax “~” है |  अगर कोई एक statement false होता है तब  expression का आउटपुट ‘false’ होगा | और अगर दोनों statement true और false होता है तब आउटपुट true होगा |
इसका truth tabel होता है |
अगर input a = 1 or int b= 1 than output 1 होता है |
अगर input a = 1 or int b= 0 than output 0 होता है |
अगर input a = 0 or int b= 1 than output 0 होता है |
अगर input a = 0 or int b= 0 than output 1 होता है |
इसका उदाहरण होता है :-
#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;
if (a==10 ~ b== 100)
{
cout<<“a or b is larger than 100 “;
}
else
{
cout<<“a or b is not larger than 100”;
}
getch();
}
इसका आउटपुट होगा
Enter First Value : 12
Enter Second Value : 23
a or b is not larger than 100