boolalpha

功能

boolalpha 把bool值顯示爲 true/false

頭文件

#include<iostream>

using namespace std;

示例

#include<iostream>
using namespace std;
int main()
{
    bool a=true;
     cout<<"a="<<a<<endl;
     cout <<"a=" <<  boolalpha << a<<endl;
    return 0;
}

輸出結果:

a=1;

a=true;

發佈了72 篇原創文章 · 獲贊 108 · 訪問量 23萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章