-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogical.cpp
51 lines (39 loc) · 1.46 KB
/
logical.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
int main(){
bool a {true};
bool b {false};
bool c {true};
std::cout<<std::boolalpha;
std::cout<<"a : "<< a<<std::endl;
std::cout<<"b : "<< b<<std::endl;
std::cout<<"c : "<< c<<std::endl;
std::cout<<std::endl;
std::cout<<"Basic and operation"<<std::endl;
std::cout<<"a && b : "<< (a && b)<<std::endl;
std::cout<<"b && c : "<< (b && c)<<std::endl;
std::cout<<"a && b && c : "<< (a && b && c )<<std::endl;
std::cout<<std::endl;
std::cout<<"a || b "<< (a || b)<<std::endl;
std::cout<<"a || c "<< (a || c)<<std::endl;
std::cout<<"a || b || c "<< (a || b || c)<<std::endl;
std::cout<<std::endl;
std::cout<<"Basic Not operator"<<std::endl;
std::cout<<"!a : "<< !a <<std::endl;
std::cout<<"!b : "<< !b <<std::endl;
std::cout<<"!c : "<<!c <<std::endl;
std::cout<<std::endl;
std::cout<<"combining logical operator"<<std::endl;
std::cout<<"!(a && b) || c : "<< (!(a && b) || c) <<std::endl;
std::cout<<"combining logical operator with relationl operators"<<std::endl;
int d {45};
int e {20};
int f {11};
std::cout<<std::endl;
std::cout<<"Relation and operator onj interger "<<std::endl;
std::cout<<"d : "<< d<<std::endl;
std::cout<<"e : "<< e<<std::endl;
std::cout<<"f : "<< f<<std::endl;
std::cout<<std::endl;
std::cout<<"(d > e) && (d > f)"<<( (d > e) && (d > f))<<std::endl;
return 0;
}