By default, iostream objects display bool variables as 0 and 1. Learn how to override this setting.
Inserting the format flag boolalpha to the object stream will force iostream objects to display the literal names instead:
using namespace std;
bool b = true;
cout<<b; // default setting; output 1
cout<<boolalpha; //henceforth,display 'true' and 'false'
The symbols true and false are locale-dependent, so in a different locale they will be replaced with that locale's equivalents.
Take advantage of special member promotions, everyday discounts, quick access to saved content, and more! Join Today.