Boolean values are integral types and when they are printed, integer values corresponding to true and false as 1 and 0 are printed.
To print boolean values in alphabet, we can use I/O manipulator boolalpha that changes the way boolean values are interpreted in streams.
Following simple program shows this.
#include <iostream>
int main(int argc, char const *argv[])
{
bool value = true;
std::cout << std::boolalpha;
std::cout << value << std::endl;
std::cout << std::noboolalpha;
std::cout << value << std::endl;
return 0;
}It should give result,
❯ g++-15 -ggdb -std=c++20 boolalpha.cpp
❯ ./a.out
true
1
This is “sticky” which means we need reset it to the default behavior using noboolalpha.