Boolean represents just two values, i.e. True/1 or False/0.
A bool Data Type can accept only true or false.
#include <iostream> using namespace std; int main() { bool x = true; bool y = false; cout << x << endl; cout << y; return 0; }
So, in the above code, we have created a variable named x of Boolean data type and initialised it with value true and internally true gets converted to 1.
bool x = true;
And created one more variable called y of Boolean data type and initialised it with value false and internally false gets converted to 0.
bool y = false;
But if we want to initialise a Boolean type variable with anything other than true/false, it would end up with an error.