+ 2
Can XOR and XNOR be applied by C++ logic??
4 Antworten
0
Added simple/sample code. Check in my code playground "Logical gates in C++"
0
Who has given down voted for me? Could you please give the reason?
0
yes got the idea of how these gates can be applied
for xor (a*(!b))+((!a)*b)
and for xnor (a*b)+((!a)*(!b))
got the idea
- 1
Yes you can apply, like this
int a = 10, b = 5;
int xorvalue = a ^ b;
int xnor = !(a ^ b);
cout << xorvalue << "\t" << xnor; // 15 0
For others,
not a = ! a
a or b = a | b
a nor b = !(a | b)
a and b = a & b
a nand b = !(a & b)
a xor b = a ^ b
a xnor b = !(a ^ b)
Hope this will help you to solve your problem.