boolalpha

· C++
bool 변수에 true 혹은 false 값을 저장해도 cout 으로 출력할 때는 1 혹은 0 으로 출력한다. 따라서 아래 코드와 같이 boolalpha를 사용해 bool 값을 true/false 로 출력할 수 있다. noboolalpha를 사용해 다시 1/0으로 출력할 수도 있다. #include "iostream" #include using namespace std; int main(void) { bool b = true; cout
20240619
'boolalpha' 태그의 글 목록