Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class logic {
- AND(x,y)
- {
- if(x && y) return 1;
- else return 0;
- }
- OR(x,y)
- {
- if(x || y) return 1;
- else return 0;
- }
- NOT(x)
- {
- if(!x) return 1;
- else return 0;
- }
- NAND(x,y)
- {
- if(this.NOT(this.AND(x,y))) return 1;
- else return 0;
- }
- NOR(x,y)
- {
- if(this.NOT(this.OR(x,y))) return 1;
- else return 0;
- }
- XOR(x,y)
- {
- if(this.OR(x,y) && this.NAND(x,y)) return 1;
- else return 0;
- }
- XNOR(x,y)
- {
- if(this.NOT(this.XOR(x,y))) return 1;
- else return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement