#include <iostream>
#include <string>
using namespace std;
int main()
{
string p;
string q;
string operation;
cout << "Enter truth value of p: ";
cin >> p;
cout << "Enter truth value of q: ";
cin >> q;
cout << "Enter the operation: ";
cin >> operation;
switch (operation == "and")
{
case 1:
{
if (( p == "true" ) && ( q == "true" ))
{
cout << "The truth value is true" << endl;
}
else
{
cout << "The truth value is false" << endl;
}
break;
}
}
switch (operation == "or")
{
case 1:
{
if (( p == "false" ) && ( q == "false" ))
{
cout << "The truth vale is false" << endl;
}
else
{
cout << "The truth value is true" << endl;
}
break;
}
}
switch ( operation == "then" )
{
case 1:
{
if ( ( p == "true" ) && ( q == "false" ) )
{
cout << "The truth value is false" << endl;
}
else
{
cout << "the truth value is true" << endl;
}
break;
}
}
switch ( operation == "exclusive or" )
{
case 1:
{
if ( ( p == "true" ) && ( q == "true" ) )
{
cout << "the truth value is false" << endl;
}
break;
}
case 2:
{
if ( ( p == "false" ) && ( q == "false" ) )
{
cout << "The truth value is false" << endl;
}
break;
}
default:
{
cout << "the truth value is true" << endl;
}
}
return 0;
}