+ 2

Can XOR and XNOR be applied by C++ logic??

25th Nov 2016, 5:26 PM
sidhant soni
sidhant soni - avatar
4 Answers
0
Added simple/sample code. Check in my code playground "Logical gates in C++"
25th Nov 2016, 7:27 PM
Venkatesh(Venki)
Venkatesh(Venki) - avatar
0
Who has given down voted for me? Could you please give the reason?
26th Nov 2016, 12:51 PM
Venkatesh(Venki)
Venkatesh(Venki) - avatar
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
29th Nov 2016, 4:38 PM
sidhant soni
sidhant soni - avatar
- 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.
25th Nov 2016, 6:57 PM
Venkatesh(Venki)
Venkatesh(Venki) - avatar