7

Bool

  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. int main() {
  5.     using std::cout;
  6.     using std::endl;
  7.  
  8.     int p, q;
  9.  
  10.     cout << "\n!p || q" << endl;
  11.     cout << "---------" << endl;
  12.  
  13.     p = 0, q = 0;
  14.     cout << p << " " << q << " --> ";
  15.     cout << (!p || q) << endl;
  16.  
  17.     p = 0, q = 1;
  18.     cout << p << " " << q << " --> ";
  19.     cout << (!p || q) << endl;
  20.  
  21.     p = 1, q = 0;
  22.     cout << p << " " << q << " --> ";
  23.     cout << (!p || q) << endl;
  24.  
  25.     p = 1, q = 1;
  26.     cout << p << " " << q << " --> ";
  27.     cout << (!p || q) << endl;
  28.  
  29.     exit( 0 );
  30. }
$ 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

Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]command[/code], [code=language]source code in c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].