assignment12 - cout <<

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* Write a program to create the following truth table. DO NOT HARD-CODE THE ANSWERS IN THE OUTPUT! This means that each of the cout statements must use variables for the "1" and "0" values. In this exercise, you need to make the output match exactly, including the spacing on each line. =============================== 1 | 1 | 1 | 0 1 | 0 | 0 | 1 0 | 1 | 0 | 1 0 | 0 | 0 | 1 */ 0 #include<iostream> using namespace std; int main () { bool x,y; b cout << " x\t|\ty\t|\t(x & y)\t|\t!(x && y)"
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout << "=======================================================================" << endl; x = true, y = true ; cout << x << "\t|\t" << y << "\t|\t" << (x&&y) << "\t\t|\t" << !(x&&y)<< endl; x = true, y = false ; cout << x << "\t|\t" << y << "\t|\t" << (x&&y) << "\t\t|\t" << !(x&&y)<< endl; x= false, y = true; cout << x << "\t|\t" << y << "\t|\t" << (x&&y) << "\t\t|\t" << !(x&&y)<< endl; x = false, y = false; cout << x << "\t|\t" << y << "\t|\t" << (x&&y) << "\t\t|\t" << !(x&&y)<< endl; c }...
View Full Document

This note was uploaded on 01/11/2010 for the course CMPSC 101 taught by Professor Drobish,renee during the Summer '07 term at Penn State.

Ask a homework question - tutors are online