Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
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
Archives
Today
Total
관리 메뉴

행복한 개구리

C++ Tutorial - Booleans / Boolean Expressions 본문

C++/공부내용

C++ Tutorial - Booleans / Boolean Expressions

HappyFrog 2022. 6. 14. 17:17

 

 

 


참거짓 표현식

참거짓 표현식은 참거짓값을 반환하는 C++ 표현식입니다:  (참) 또는  (거짓)

 

당신은 초과 연산자( > )와 같은 비교 연산자를 사용하여 표현식(또는 변수)이 참인지 알아낼 수 있습니다.

 

 

예시

#include <iostream>

using namespace std;

int main() {
	int x = 10;
	int y = 9;
	cout << (x > y);
}

 

또는 더 쉽게 만들어보면:

 

 

예시

#include <iostream>

using namespace std;

int main() {
	cout << (10 > 9);
}

 

아래에 있는 예시에서는 우리는 동치 연산자 ( == )를 사용하여 표현식을 평가해 볼 것입니다.

 

 

예시

#include <iostream>

using namespace std;

int main() {
	int x = 10;
	cout << (x == 10);
}

 

 

예시

#include <iostream>

using namespace std;

int main() {
	cout << (10 == 15);
}

 

참거짓타입은  C++비교와 조건들의 근간이 됩니다.

 

당신은 다음 조건 챕터에서 더 많은 것을 배울 것입니다.

'C++ > 공부내용' 카테고리의 다른 글

C++ Tutorial - Conditions / Else  (0) 2022.06.14
C++ Tutorial - Conditions / If  (0) 2022.06.14
C++ Tutorial - Booleans / Boolean Values  (0) 2022.06.14
C++ Tutorial - Math  (0) 2022.06.14
C++ Tutorial - Strings / Omitting Namespace  (0) 2022.06.13