5.3 布尔值表示
cout<<"the expression x=100 has the value";
cout<<(x=100)<<endl;
cout<<"the expression x<3 has the value";
cout<<(x<3)<<endl; //输出0
cout.setf(ios_base::boolalpha);//该函数调用设置了一个标记,该标记命令显示true和false,而不是1和0
cout<<"the expression x<3 has the value";
cout<<(x<3)<<endl; //输出false
评论