In: Computer Science
Write a program that inputs the values of three Boolean variables, a, b, and c, from a “cin” operator (user gives the values be sure to prompt user for what they have to give!). Then the program determines the value of the conditions that follow as true or false. 1. !(a&&b&&c) && ! (a||b||c) 2. !(a||b)&&c Output should include the values of a,b,c ie 0 or 1 in the patterns that follow reflecting the Boolean logic being tested. Where “True” or “False” are in string variables. Study this example! for input of a=1 and b =0 and c=1 results in output looking like !( 1&&0&&1) && !(1|| 0||1) is False !(1||0)&&1 is False Run for the eight cases of a,b,c in Table 3.2 (both editions of text) Warning follow this output example format else you will have to redo it! Hint: your output statements will be large! Hint:. you have to use strings and variables for parts like<< “!(<
Thanks for the question, here is the code in C++
==================================================================
#include<iostream>
using namespace std;
// return a valid value either 1 or 0 only
int get_value(int &var, char letter){
do{
cout<<"Enter value for "<<letter<<" (1 for true 0 for false): ";
cin>>var;
}while(!(var==1 || var==0));
}
int main(){
int a, b, c;
get_value(a,'a');
get_value(b,'b');
get_value(c,'c');
cout<<endl<<endl;
bool d= !(a&&b&&c) && !(a||b||c);
cout<<"!( "<<a<<" && "<<b<<" && "<<c<<" ) && !( "<<a<<" || "
<<b<<" || "<<c<<" ) = "<<boolalpha<<d<<endl;
cout<<endl;
bool e = !(a||b)&&c;
cout<<"!( "<<a<<" || "<<b<<" ) && "<<c<<" = "<<boolalpha<<e<<endl;
}