c++:coutはbookを直接trueとfalseに出力します.

1937 ワード

//---------------------------------------
//  boolalpha   bool  
//  noboolalpha       
//--------------------------------------

#include "stdafx.h"

#include 

using namespace std;

int main(int argc, char* argv[])

{

 bool test = true;

 cout << "the output is number " << test << endl;

 cout << "the output is bool(use boolalpha) " << boolalpha << test << endl;

 cout << "the output is number(use noboolalpha) " << noboolalpha << test << endl;

 system("pause");

 return 0;

}
出力:
the output is number 1

the output is bool(use boolalpha) true

the output is number(use noboolalpha) 1

       . . .