C++ examples for Data Type:bool
Set output format for bool variables to true and false instead of 1 and 0
#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int main(int nNumberofArgs, char* pszArgs[]) { // set output format for bool variables to true and false instead of 1 and 0 cout.setf(cout.boolalpha);//from w w w.j a v a 2 s . co m int nArg1 = 7; int nArg2 = 9; bool b; b = nArg1 == nArg2; cout << "The statement, " << nArg1 << " equals " << nArg2 << " is " << b << endl; return 0; }