ios_base& boolalpha (ios_base& str);
Sets the boolalpha format flag for the str stream.
When the boolalpha format flag is set, bool
values are inserted/extracted by their textual representation: either true
or false
, instead of integral values.
This flag can be unset with the noboolalpha manipulator.
For standard streams, the boolalpha flag is not set on initialization.
boolalpha是头文件#include <iostream>中的一个函数,是把bool a 变量打印出false或者true的函数.
使用如下:
#include <iostream>
using namespace std;
int main() {
bool a=true;
cout<<"请输入一个数值为布尔变量a赋值:"<<endl;
cout<<"=================分隔符===========