【c++11关键字】 bool
2020-10-19 本文已影响0人
小鱼号的代码日记
/*
* c++11关键字
* bool
* 小鱼号的代码日志
*/
#include <QCoreApplication>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
bool b = false;
*(reinterpret_cast<char *>(&b)) = -1;
if(b == true)
{
cout << "i am true";
}
else if(b == false)
{
cout << "i am false";
}
else
{
cout << "i am what";
}
///bool判断的正确写法
if(b)
{
cout << "bool";
}
return a.exec();
}