放牧代码和思想
专注自然语言处理、机器学习算法
    This thing called love. Know I would've. Thrown it all away. Wouldn't hesitate.

cout << boolalpha用法

默认情况下是0和1,cout << boolalpha是用true和false输出bool的值:

#include <iostream>
using namespace std;

///////////////////////////SubMain//////////////////////////////////
int main(int argc, char *argv[])
{
	// 把bool值显示为true或false
	bool b = false;
	cout << b << endl;
	cout << boolalpha;
	cout << b << endl;
	system("pause");
	return 0;
}
///////////////////////////End Sub//////////////////////////////////

输出:

0
false
请按任意键继续. . .

知识共享许可协议 知识共享署名-非商业性使用-相同方式共享码农场 » cout << boolalpha用法

评论 欢迎留言

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

我的作品

HanLP自然语言处理包《自然语言处理入门》