Logic Functions
This commit is contained in:
1 parent
75d203cfd5
commit
5b739eda96
1 file changed
+20
@@ -0,0 +1,20 @@
|
||||
#include "logicfunctions.h"
|
||||
|
||||
// Compute xor
|
||||
void exclusive(bool x, bool y, bool& ans){
|
||||
ans = x ^ y;
|
||||
}
|
||||
|
||||
// Compute implication
|
||||
void implies(bool x, bool y, bool& ans){
|
||||
if (!(x || y)) {
|
||||
ans = true;
|
||||
} else {
|
||||
ans = y;
|
||||
}
|
||||
}
|
||||
|
||||
// Compute equivalence
|
||||
void equivalence(bool x, bool y, bool& ans){
|
||||
ans = x == y;
|
||||
}
|
||||
Reference in new issue
Block a user