(C++) std::boolalpha

January 7, 2018 · View on GitHub

std::boolalpha is a stream manipulator to print the boolian values false and true as 'false' and 'true' instead of '0' and '1'.

#include <iomanip>
#include <iostream>

int main() 
{   
  const bool a = true;   
  const bool b = false;
  std::cout << std::boolalpha << a << ' ' << b << '\n'; 
}

This will display:

true false