Hi,

have been asked to produce a c program allowing the user to simulate combinational logic gates where the user inputs binary values for A,B and C and the output circuit is displayed. have been given a template array to use with the program which contains the binary info for AND, OR and NOT gates.

the first part of the spec tells me to Start by adding C functions for simulating additional logic gates: XOR, XNOR, NAND and NOR.

all i am looking for is how would i go about answering the first part.... adding c functions for the XOR, XNOR etc logic gates as this part is confusing me?

The template code is shown below!

Code:#include<stdio.h> int And(int a, int b); int Or(int a, int b); int Not(int a); void main() {///where main body of code will go} int And(int a, int b) { int output; if(a==0 && b==0) output=0; if(a==1 && b==0) output=0; if(a==0 && b==1) output=0; if(a==1 && b==1) output=1; return (output); } int Or(int a, int b) { int output; if(a==0 && b==0) output=0; if(a==1 && b==0) output=1; if(a==0 && b==1) output=1; if(a==1 && b==1) output=1; return (output); } int Not(int a) { int output; if(a==0 ) output=1; if(a==1 ) output=0; return (output); }