c++中的boolean和bool有什么不同
bool是c++中的一个关键字,属于c++类型的一种
boolean是定义来的,下面是boolean的类型定义
代码:
#include <iostream>
using namespace std;
int main()
{
bool start =-100;//将被转换为true
bool stop = 0; //将被转换为false
int ans = true;
int promise =false;
bool b = 100; //bool b = ture;(没有true)不是0则是ture是 1
bool c = false;
cout<<b<<endl;//运行结果为1
cout<<c<<endl;//运行结果为0
cout<<ans<<endl;//
cout<<promise<<endl;//
cout<<start<<endl;//
cout<<stop<<endl;//
return 0;
}
结果:
1 0 1 0 1 0
自己阅读