JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Categories: c++ language in hindi

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

Sbistudy

Recent Posts

सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है

सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…

21 hours ago

मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the

marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…

21 hours ago

राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi

sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…

3 days ago

गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi

gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…

3 days ago

Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन

वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…

3 months ago

polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten

get all types and chapters polity notes pdf in hindi for upsc , SSC ,…

3 months ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now