Home bool 출력 시 true, false 로 출력하기
Post
Cancel

bool 출력 시 true, false 로 출력하기

bool a = true; 를 바로 출력하는 경우 0이나 1처럼 숫자로 표현 되는 경우가 있었다.

std::cout 을 할 때, 출력하려는 변수의 앞 뒤로 std::boolalpha 를 추가해주면 truefalse로 출력이 된다.

1
2
3
4
5
6
7
...
bool a = true;

std::cout << std::boolalpha << a << std::boolalpha << std::endl;
...

Reference

JArchive 프로그래밍 일기

This post is licensed under CC BY 4.0 by the author.

선형대수 (2)

난수 생성