Boolean:
The boolean data type, which can represent logical values, is a built-in data type in C++. There can be two values for it: false and true.
Example:
#include <iostream>
using namespace std;
int main() {
bool b1 = true;
bool b2 = false;
cout << boolalpha; // set output to print "true" and "false" instead of "1" and "0"
cout << "b1 = " << b1 << endl;
cout << "b2 = " << b2 << endl;
bool b3 = (10 > 5);
bool b4 = (10 < 5);
cout << "b3 = " << b3 << endl;
cout << "b4 = " << b4 << endl;
return 0;
}
Output:
b1 = true
b2 = false
b3 = true
b4 = false