///////
//
// Student: Russell Lowke
//     T.F: Francis Crick
// Unit Three, pencil-and-paper - question 3 [worth 2pts],  7/6/2002
//
//  C++ program that prints a table showing the value of the 
//  Boolean expression:   p1 && !( p2 || (p3 && !p4))
//  for each of the 16 possible combinations of truth values of the
//  boolean vars p1, p2, p3, and p4
//    
//

#include <iostream>
#include <iomanip>

void main()
{
    bool p1 = false, 
         p2 = false,
         p3 = false,
         p4 = false;
	int counter = 0;
	
	// loop through all possible values of p1 thru p4
	do {
		do {
			do {
				do {
				
					cout << setw(3) << ++counter << ")  " << p1 << p2 << p3 << p4;
					cout << setw(5) << " = " << ( p1 && !( p2 || (p3 && !p4)) );
					cout << endl;
					
					p4 = !p4;
				} while (p4 == true);
				
				p3 = !p3;
			} while (p3 == true);
				
			p2 = !p2;
		} while (p2 == true);
	
		p1 = !p1;
	} while (p1 == true);
}