Bool

bool.h
1
2
3
4
5
6
7
8
#ifndef EXAMPLES_BOOL_H_
#define EXAMPLES_BOOL_H_

#include <iostream>

void displayBool();

#endif /* EXAMPLES_BOOL_H_ */
bool.cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include "bool.h"

using namespace std;

void displayBool()
{
    int a = 2;
    int b = 3;

    bool b1 = a > b;
    bool b2 = a < b;
    bool b3 = a;

    cout << "b1 = " << b1 << endl;
    cout << "b2 = " << b2 << endl;
    cout << "b3 = " << b3 << endl;

    cout << "b1 = " << boolalpha << b1 << endl;
    cout << "b1 = " << noboolalpha << b1 << endl;
}