Question

Find the complement of the function F: F = xy + xy'z + x'yz

Find the complement of the function F:

F = xy + xy'z + x'yz

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<bits/stdc++.h>

using namespace std;

int main()
{
   // We have to calculate compliment of   F = xy + xy'z + x'yz
   //which is
                   //F'= (xy+xy'z+x'yz)'
                  
   //We will constrcut the Truth Table for the above equation
   char x[8]= {'T','T','T','T','F','F','F','F'};
   char y[8]= {'T','T','F','F','T','T','F','F'};
   char z[8]= {'T','F','T','F','T','F','T','F'};
  
   char y_comp[8],x_comp[8],xy[8],x_ycmp_z[8],xcmp_y_z[8];
   char F[8],F_comp[8];
  
   //For calculating compliment of x and y......x', y'
  
   for(int i=0; i<8; i++){
      
       // Compliment of x
       if(x[i]=='T'){
           x_comp[i]='F';
       }
       else{
           x_comp[i]='T';
       }
       //Compliment of y
       if(y[i]=='T'){
           y_comp[i]='F';
       }
       else{
           y_comp[i]='T';
       }
   }
  
   //For Calculating xy
  
   for(int i=0; i<8; i++){
       if(x[i]=='T' && y[i]=='T'){
           xy[i]='T';
       }
       else{
           xy[i]='F';
       }
   }
  
   //For Calculating xy'z
      
   for(int i=0; i<8; i++){
       if(x[i]=='T' && y_comp[i]=='T'&& z[i]=='T'){
           x_ycmp_z[i]='T';
       }
       else{
           x_ycmp_z[i]='F';
       }
   }
  
   //For Calculating x'yz
      
   for(int i=0; i<8; i++){
       if(x_comp[i]=='T' && y[i]=='T'&& z[i]=='T'){
           xcmp_y_z[i]='T';
       }
       else{
           xcmp_y_z[i]='F';
       }
   }
  
   //For Calculating F= xy + xy'z + x'yz
      
   for(int i=0; i<8; i++){
       if(xy[i]=='T' || x_ycmp_z[i]=='T' || xcmp_y_z[i]=='T'){
           F[i]='T';
       }
       else{
           F[i]='F';
       }
   }
  
   //For Calculating F'= (xy + xy'z + x'yz)'
      
   for(int i=0; i<8; i++){
       if(F[i]=='T'){
           F_comp[i]='F';
       }
       else{
           F_comp[i]='T';
       }
   }
  
   //Printing out the result
  
   cout<<"\n\n\t\t\tF = xy + xy'z + x'yz"<<endl<<endl;
   cout<<"\n\n\t\t\tF'= (xy + xy'z + x'yz)'"<<endl<<endl;
   cout<<"\n\n\tx\ty\tz\tx'\ty'\txy\txy'z\tx'yz\tF\tF'"<<endl<<endl;
  
   //x       y   z   x'   y'   xy   xy'z   x'yz   xy+xy'z+x'yz   (xy+xy'z+x'yz)'
  
   for(int i=0; i<8; i++){
       cout<<"\t"<<x[i]<<"\t"<<y[i]<<"\t"<<z[i]<<"\t"<<x_comp[i]<<"\t"<<y_comp[i]<<"\t"<<xy[i]<<"\t"<<x_ycmp_z[i]<<"\t"<<xcmp_y_z[i]<<"\t"<<F[i]<<"\t"<<F_comp[i]<<endl;
   }
}

COMMENT DOWN FOR ANY QUERIES AND,

LEAVE A THUMBS UP IF THIS ANSWER HELPS YOU.

Add a comment
Know the answer?
Add Answer to:
Find the complement of the function F: F = xy + xy'z + x'yz
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT