Cpp - Output Boolean Values

Introduction

By default the << operator outputs boolean values as integers, with the value 0 representing false and 1 true.

To output the strings true or false instead, the flag ios::boolalpha must be set.

Use either the setf() method or the manipulator boolalpha.

bool ok = true; 
cout << ok << endl                // 1 
     << boolalpha << ok << endl;  // true 

You can revert this setting using the noboolalpha manipulator.