Booleans in both formats : bool output « Data Type « C++






Booleans in both formats

  
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
  cout << "Default format: " << 123.123456789 << endl;

  cout << "Booleans in both formats: ";
  cout << true << " " << false << " " << boolalpha
       << true << " " << false << "\n\n";

  return 0;
}
  
    
  








Related examples in the same category

1.Set the boolalpha flag on cout
2.Clear the boolalpha flag
3.Demonstrate the setf() and unsetf() functions.