devxlogo

Viewing bool Variables as Literals

Viewing bool Variables as Literals

By default, iostream objects display bool variables as 0 and 1. You can override the default setting by inserting the formatting flag boolalpha to the object stream. Consequently, the symbolic representations ‘false’ and ‘true’ will be displayed instead:

 #include using namespace std;void main() {     bool b = true; cout

devx-admin

Share the Post: