C++ bool returns 0 1 instead of true false

You can use std::boolalpha: Sets the boolalpha format flag for the str stream. When the boolalpha format flag is set, bool values are inserted/extracted as their names: true and false instead of integral values. This flag can be unset with the noboolalpha manipulator. The boolalpha flag is not set in standard streams on initialization. std::cout.setf(std::ios::boolalpha); … Read more

Why is a char and a bool the same size in c++?

In modern computer architectures, a byte is the smallest addressable unit of memory. To pack multiple bits into a byte requires applying extra bit-shift operations. At the compiler level, it’s a trade off of memory vs. speed requirements (and in high-performance software, those extra bit-shift operations can add up and slow down the application needlessly).