bool类型
bool类型是C++中的基本数据类型,为一种整型类型。
* bool类型单独占据一个字节即八个二进制位,取值true(1)或false(0)。
* 任何非0数都为true,0转换为false。
* C语言中不存在bool类型。
#include<iostream>
using namespace std;
int main{
bool a = -1; //bool类型非0的-1转换为1
int b = 5; //int整型 5
int c = 0; //int整型 0
bool d = 6; //bool类型非0的6转换为1
cout << a << endl;//1
cout << b << endl;//5
cout << c << endl;//0
cout << d << endl;//1
return 0;
}