CS153/hw6/hw4programs/xor_bool.oat

17 lines
245 B
Text
Raw Permalink Normal View History

bool xor(bool x, bool y) {
return (x & !y) | (!x & y);
}
int to_int(bool b) {
if (b) {
return 1;
} else {
return 0;
}
}
int program(int argc, string[] argv) {
var t = true;
var f = false;
return to_int(xor(t, t));
}