Professional Documents
Culture Documents
Write A C++ Code That Takes Any Expression As Inpu... - Chegg - Co
Write A C++ Code That Takes Any Expression As Inpu... - Chegg - Co
Home Study tools My courses My books My folder Career Life
Expert Answer
Anonymous
answered this
Answer
i).
#include<iostream>
using namespace std;
bool f;
f = !(p || q);
if(f){
return 1;
}
return 0;
bool f;
f = !p && !q;
if(f){
return 1;
}
return 0;
bool f;
f = (p || q) && !r;
if(f){
return 1;
}
return 0;
bool f;
if(f){
return 1;
}
return 0;
int main()
int p,q,r;
char ch;
do{
cin>>p;
cin>>q;
cin>>r;
r1 =
evaluate1(p,q);
r2 =
evaluate2(p,q);
r3 =
evaluate3(p,q,r);
r4 =
evaluate4(p,q,r);
cout<<"\np\tq\tr\t!(p || q)\t!p && !q\t(p || q)
&& !r\t!(p || (!q && r))";
cout<<"\n\n"<<p<<"\t"<<q<<"\t"<<r<<"\t
"<<r1<<"\t\t "<<r2<<"\t\t
"
<<r3<<"\t\t "<<r4;
cout<<"\nEnter Y/y for run the program again: ";
cin>>ch;
}
else{
cout<<"\nInvalid Input!!\nProgram Terminated";
}
}while(ch=='Y'||ch=='y');
return 0;
Code Screenshot: -
Output Screenshot: -
1
Questions viewed by other students
COMPANY
CHEGG NETWORK
CUSTOMER SERVICE