11_16.cpp

来自「C++案例教程源代码」· C++ 代码 · 共 16 行

CPP
16
字号
#include <iostream>
using namespace std;
int main()
{  bool boolValue = true; 
   cout << "boolValue is " << boolValue << endl; //语句1:显示默认布尔值真
   cout << "boolValue (after using boolalpha) is "
        << boolalpha << boolValue << endl ; 	//语句2:使用 boolalpha后显示布尔值
   cout << "switch boolValue and use noboolalpha" << endl;
   boolValue = false; 							//改变boolValue
   cout << noboolalpha << endl;					//语句3:使用noboolalpha
   cout << "boolValue is " << boolValue << endl;   //使用noboolalpha后显示boolValue
   //重新使用boolalpha
   cout << "boolValue (after using boolalpha) is "<< boolalpha << boolValue << endl;
   return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?