1 #include <iostream>
2 using namespace std;
3
4 int main(void){
5 bool b = false;
6 cout << b << endl;//0
7 //插入流控制符boolalpha,以字符串形式打印bool
8 cout << boolalpha << b << endl;//false
9
10 return 0;
11 }
运行之后~
tarena@ubuntu:~/cplus/day01$ g++ 10bool.cpp
tarena@ubuntu:~/cplus/day01$ ./a.out
0
false
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。