测试项目:
1.bool 变量的 四则运算
2.bool 变量所在内存大小
测试代码:
#include <iostream>
using namespace std;
int main()
{
int iSizeCouner = 0;
bool bTestBool = false;
bool a = 3;
bool b = 1;
bool c = a + b;
bool d = a - b;
// test
cout << "a = " << a <<endl;
cout << "b = " << b<<endl;
cout << "c = " << c<<endl;
cout << bTestBool <<endl;
cout << bTestBool <<endl;
bTestBool = true;
cout <<boolalpha<
1.bool 变量的 四则运算
2.bool 变量所在内存大小
测试代码:
#include <iostream>
using namespace std;
int main()
{
int iSizeCouner = 0;
bool bTestBool = false;
bool a = 3;
bool b = 1;
bool c = a + b;
bool d = a - b;
// test
cout << "a = " << a <<endl;
cout << "b = " << b<<endl;
cout << "c = " << c<<endl;
cout << "d = " << d <<endl;
iSizeCouner = sizeof(bTestBool);
cout << iSizeCouner <<endl;cout << bTestBool <<endl;
cout << bTestBool <<endl;
bTestBool = true;
cout <<boolalpha<