-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path03.cpp
46 lines (36 loc) · 1.16 KB
/
03.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
#include <iostream>
using namespace std;
int main() {
// 논리연산자
// &&(논리And), ||(논리 Or), !(논리 not)
bool TRUE = 2000;
bool FALSE = 0;
// 논리 And 연산자, 그리고
// 논리 And 연산자는 false 확률이 높은 것을 앞쪽에 놓는 것이 유리합니다.
bool ret = TRUE && TRUE;
cout << "TRUE && TRUE = " << ret << endl;
ret = TRUE && FALSE;
cout << "TRUE && FALSE = " << ret << endl;
ret = FALSE && TRUE;
cout << "FALSE && TRUE = " << ret << endl;
ret = FALSE && FALSE;
cout << "FALSE && FALSE = " << ret << endl;
cout << endl;
// 논리 Or 연산자
// 논리 Or 연산자는 true 확률이 높은 것을 앞쪽에 놓는 것이 유리합니다.
ret = TRUE || TRUE;
cout << "TRUE || TRUE = " << ret << endl;
ret = TRUE || FALSE;
cout << "TRUE || FALSE = " << ret << endl;
ret = FALSE || TRUE;
cout << "FALSE || TRUE = " << ret << endl;
ret = FALSE || FALSE;
cout << "FALSE || FALSE = " << ret << endl;
cout << endl;
// 논리 Not 연산자
ret = !TRUE;
cout << "!TRUE = " << ret << endl;
ret = !FALSE;
cout << "!FALSE = " << ret << endl;
return 0;
}