Demonstrate the setf() and unsetf() functions. : bool output « Data Type « C++






Demonstrate the setf() and unsetf() functions.

  
#include <iostream>

using namespace std;

int main()
{
  // Set the boolalpha flag on cout.
  cout.setf(ios::boolalpha);

  cout << true << endl;;

  // clear the boolalpha flag.
  cout.unsetf(ios::boolalpha);

  cout << true << endl;;

  return 0;
}
  
    
  








Related examples in the same category

1.Set the boolalpha flag on cout
2.Clear the boolalpha flag
3.Booleans in both formats