-
Description or
,xor
andand
are C++ keyword.they can be using as||
,~
and&&
.Code bool Or(bool a, bool b){ return a or b; } bool Xor(bool a, bool b){ return a xor b; } bool And(bool a, bool b){ return a and b; }
Test Cases // TODO: Replace examples and use TDD development by writing your own tests Describe(AND_OR_XOR) { It(AND) { Assert::That(And(true, false), Equals(false)); Assert::That(And(false, true), Equals(false)); Assert::That(And(true, true), Equals(true)); Assert::That(And(false, false), Equals(false)); } It(OR) { Assert::That(Or(true, false), Equals(true)); Assert::That(Or(false, true), Equals(true)); Assert::That(Or(true, true), Equals(true)); Assert::That(Or(false, false), Equals(false)); } It(XOR) { Assert::That(Xor(true, false), Equals(true)); Assert::That(Xor(false, true), Equals(true)); Assert::That(Xor(true, true), Equals(false)); Assert::That(Xor(false, false), Equals(false)); } };
Output:
-
Code - bool Or(bool a, bool b){
return a + b;- return a or b;
- }
- bool Xor(bool a, bool b){
return a != b;- return a xor b;
- }
- bool And(bool a, bool b){
return a * b;- return a and b;
- }
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}