Set the boolalpha flag on cout : bool output « Data Type « C++






Set the boolalpha flag on cout

  
#include <iostream>

using namespace std;

int main()
{
  cout.setf(ios::boolalpha);

  cout << true << endl;;

  cout.unsetf(ios::boolalpha);

  cout << true << endl;;

  return 0;
}
  
    
  








Related examples in the same category

1.Clear the boolalpha flag
2.Booleans in both formats
3.Demonstrate the setf() and unsetf() functions.