美文网首页程序员
【c++11关键字】 bool

【c++11关键字】 bool

作者: 小鱼号的代码日记 | 来源:发表于2020-10-19 18:57 被阅读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();
}

相关文章

  • 【c++11关键字】 bool

  • 2018-10-06

    C++11新关键字default C++11添加了很多新特性,使C++看上去更加的灵活和面向对象,其中新关键字de...

  • Elasticsearch的APi常用查询语句格式详解

    1、关键字查询 { "query": { "bool": { "must": [ ...

  • C++11中auto和decltype

    C++11中auto和decltype auto和decltype都是C++11中引进来用于自动推断类型的关键字,...

  • 阿里巴巴面试题基础篇 C++11

    ● 请问C++11有哪些新特性? 参考回答: C++11 最常用的新特性如下: auto关键字:编译器可以根据初始...

  • c11的基础知识

    2020.04.141、c++11的default和delete关键字https://blog.csdn.net/...

  • python数据类型

    数据类型: 数字:整型、浮点型、布尔值关键字: int、float、bool 布尔值:bool、boolean、...

  • C++11/14 constexpr 用法

    constexpr是C++11开始提出的关键字,其意义与14版本有一些区别。C++11中的constexpr指定的...

  • [转]关键字noexcept

    1 关键字noexcept从C++11开始,我们能看到很多代码当中都有关键字noexcept。比如下面就是std:...

  • C++11拾穗

    C++11新关键字 alignas:指定对齐大小 alignof:获取对齐大小 decltype auto(重新定...

网友评论

    本文标题:【c++11关键字】 bool

    本文链接:https://www.haomeiwen.com/subject/hnocmktx.html