7
Bool
- #include <iostream>
- #include <cstdlib>
- int main() {
- using std::cout;
- using std::endl;
- int p, q;
- cout << "\n!p || q" << endl;
- cout << "---------" << endl;
- p = 0, q = 0;
- cout << p << " " << q << " --> ";
- cout << (!p || q) << endl;
- p = 0, q = 1;
- cout << p << " " << q << " --> ";
- cout << (!p || q) << endl;
- p = 1, q = 0;
- cout << p << " " << q << " --> ";
- cout << (!p || q) << endl;
- p = 1, q = 1;
- cout << p << " " << q << " --> ";
- cout << (!p || q) << endl;
- exit( 0 );
- }
$ make
g++ -DDEBUG -g -c -o bool.o bool.cpp
g++ bool.o -o bool
$ bool
!p || q
---------
0 0 --> 1
0 1 --> 1
1 0 --> 0
1 1 --> 1
Comments