BOOL Type
C + + new type, representing logical true and false
1. The logical type is also called the Boolean type, its value is true (logical true) and False (logical false), the number of bytes stored in the different compilation system may differ, VC + + 1 bytes.
2. Declaration method: Boolresult;result=true;
3. Can be used as integers (true is generally 1,false to 0)
4. When converting other types of values to Boolean values, non-0 values are converted to true, and 0 values are converted to false
code example:
Main.cpp#include <iostream>using namespace std;//introduced namespace int main (void) {bool Result;result = true;cout<< Result<<endl;result = 100;cout<<result<<endl;return 0;}
The code above can be seen, even if the variable result is assigned a value of 100 but because it is a bool type, the output is also 1.
Learn C + + from C to C + + (bool type) with me