/*  Name: logical.cpp  Copyright: AHD c 2006  Author: Anne Dawson  Date: 08/01/06 09:07  Description: demonstrates logical operators && (And) and || (Or)*//*  And Truth table:    F   F      F    T   F      F    F   T      F    T   T      T        Or Truth table:    F   F      F    T   F      T    F   T      T    T   T      T*/    #include <iostream> // for cin and coutusing namespace std;int main(){	int num1 = 10;	int num2 = 20;	cout << "Note: num1 = 10 and num2 = 20" << endl << endl;	if ((num1 > 5) && (num2 > 5)) // the AND operator &&	{		cout << "both num1 and num2 are greater than 5" << endl;	}	else	{		cout << "num1 and num2 are not both greater than 5" << endl;	}    system("PAUSE"); // outputs the message "Press any key to continue .  .  ."                     // and waits for as key press	    if ((num1 == 10) && (num2 == 20)) // the AND operator &&	{		cout << "num1 is equal to 10 and num2 is equal to 20" << endl;	}	else	{		cout << "num1 == 10 and num2 == 20 are not both true" << endl;	}    system("PAUSE"); // outputs the message "Press any key to continue .  .  ."                     // and waits for as key press		if ((num1 == 10) && (num2 == 10)) // the AND operator &&	{		cout << "num1 = 10 and num2 = 10" << endl;	}	else	{		cout << "num1 and num2 are not both equal to 10" << endl;	}    system("PAUSE"); // outputs the message "Press any key to continue .  .  ."                     // and waits for as key press	if ((num1 == 10) || (num2 == 10)) // the OR operator ||	{		cout << "num1 or num2 is equal to 10" << endl;	}	else	{		cout << "neither num1 or num2 is equal to 10" << endl;	}    system("PAUSE"); // outputs the message "Press any key to continue .  .  ."                     // and waits for as key press                         return 0; // integer 0 is returned to the operating system}
