当我们想输入一个BOOL类型的变量以“TRUE”的形式输入,而不是“1”,就需要使用boolalpha操作子
EXAMPLE
#include <ios>
#include <iostream>
#include <ostream>
#include <istream>
int main()
{
std::cout<<"true = "<<true<<"\n";
std::cout<<std::boolalpha;
std::cout<<"true = "<<true<<"\n";
bool test;
std::cout<<"please input \"true\": ";
std::cin>>std::boolalpha>>test;
std::cout<<std::noboolalpha<<test<<"\n";
}
POSSIBLE OUTPUT