fig21_01.cpp
来自「经典vc教程的例子程序」· C++ 代码 · 共 32 行
CPP
32 行
// Fig. 21.1: fig21_01.cpp
// Demonstrating data type bool.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
bool boolean = false;
int x = 0;
cout << "boolean is " << boolean
<< "\nEnter an integer: ";
cin >> x;
cout << "integer " << x << " is"
<< ( x ? " nonzero " : " zero " )
<< "and interpreted as ";
if ( x )
cout << "true\n";
else
cout << "false\n";
boolean = true;
cout << "boolean is " << boolean;
cout << "\nboolean output with boolalpha manipulator is "
<< boolalpha << boolean << endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?