// CS101 Laboratory #3: Inquiring about the IF statement
// Description: A program to solve for the nand function

#include <iostream>
#include <string>
using namespace std;

int main() {

	cout << "\n\n**********************************\n\n";

	// Prompt user and read input values for p and q

	cout << "Please type a logical value (0, 1): ";
	bool p;
	cin  >> p;

	cout << "Please type another logical value (0, 1): ";
	bool q;
	cin  >> q;
	

	// compute the correct value to assign to nand using if-else-if's

	bool nand;
	if ( (!p) && (!q) ) {
		nand = true;
	}
	else if ( (!p) && (q) ) {
		nand = true;
	}
	else if ( (p) && (!q) ) {
		nand = true;
	}
	else {  // (p) and (q)
		nand = false;
	}
	// display nand's value

	cout << "\n" << p << " nand " << q << " = " << nand << "\n\n";


	// we are done

	return 0;
}
