Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

********* please use visual studio and it must be C++. Thank you.*********** Wri

ID: 3840521 • Letter: #

Question

********* please use visual studio and it must be C++. Thank you.***********

Write a program that produces the truth table of the following logical operators. You can output one table with all the operators (one column for each operator) or five tables (one table for each operator), you decide. Write the header(s) of the table(s)- this is the name of the columns-. Output the result on the file prowl output.txt. The table should contain the letters 'T' and 'F', it should not print 1s and 0s. Show the results on the following order: negation disjunction (AND operator) conjunction (OR operator) exclusive or (or but not both) implication (CONDITIONAL operator) biconditional

Explanation / Answer

#include <iostream>
#include <fstream>

using namespace std;

int main()
{
   ofstream myfile;
   myfile.open ("output.txt");

   myfile << "Negation :- ";
   myfile << "A   ~A ";
   myfile << "T    F ";
   myfile << "F    T ";

   myfile << "Conjunction :- ";
   myfile << "A    B    A AND B ";
   myfile << "T    T       T ";
   myfile << "T    F       F ";
   myfile << "F    T       F ";
   myfile << "F    F       F ";

   myfile << "Disjunction :- ";
   myfile << "A    B    A OR B ";
   myfile << "T    T       T ";
   myfile << "T    F       T ";
   myfile << "F    T       T ";
   myfile << "F    F       F ";

   myfile << "Exclusive OR :- ";
   myfile << "A    B    A XOR B ";
   myfile << "T    T       F ";
   myfile << "T    F       T ";
   myfile << "F    T       T ";
   myfile << "F    F       F ";

   myfile << "Implication :- ";
   myfile << "A    B    A Implies B ";
   myfile << "T    T       T ";
   myfile << "T    F       F ";
   myfile << "F    T       T ";
   myfile << "F    F       T ";

   myfile << "Biconditional :- ";
   myfile << "A    B    A BIimplies B ";
   myfile << "T    T       T ";
   myfile << "T    F       F ";
   myfile << "F    T       F ";
   myfile << "F    F       T ";


   myfile.close();

   return 0;
}