#include int main(int argc, char** argv) { bool boolalpha_on; // get the state and print it boolalpha_on = std::cout.flags() & std::ios_base::boolalpha; std::cout << "boolalpha_on: " << boolalpha_on << "\n"; // setting manipulators or flags hold state until they are unset. // the exception is the width flag ( which is more complicated ) // true false std::cout << std::boolalpha << true << " " << false << "\n"; // true false std::cout << true << " " << false << "\n"; // get the state and print it boolalpha_on = std::cout.flags() & std::ios_base::boolalpha; std::cout << "boolalpha_on: " << boolalpha_on << "\n"; // 1 0 std::cout << std::noboolalpha << true << " " << false << "\n"; // 1 0 std::cout << true << " " << false << "\n"; // get the state and print it boolalpha_on = std::cout.flags() & std::ios_base::boolalpha; std::cout << "boolalpha_on: " << boolalpha_on << "\n"; return 0; }