// CS11 Laboratory #4: First Looks // Description: A program to solve for the nand function #include const int false = 0; const int true = 1; int main() { int p, q, nand; // Prompt user and read input values for p and q cout << "Please type a Boolean value (0, 1): "; cin >> p; cout << "Please type another Boolean value (0, 1): "; cin >> q; // compute the correct value to assign to nand using if-else-if's if ( (!p) && (!q) ) nand = true; else if ( (!p) && (q) ) nand = true; else if ( (p) && (!q) ) nand = true; else nand = false; // display nand's value cout << "\n" << p << " nand " << q << " = " << nand << "\n\n"; // we are done return 0; }