불 bool

Bool 불 타입

C++ Bool type이 존재한다. true, false 상수를 사용하며, 실제 값은 1, 0이다.

실습 예제

ch05ex2_bool.cpp

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
	bool bo;
	bo = true;
	cout << bo << endl;	 // 1

	bo = false;
	cout << bo << endl;	 // 0

	return 0;
}

Last updated