diff --git a/02_MENT/main_02_MENT.cpp b/02_MENT/main_02_MENT.cpp index 399fe6b..630d83c 100644 --- a/02_MENT/main_02_MENT.cpp +++ b/02_MENT/main_02_MENT.cpp @@ -80,13 +80,18 @@ PascalString intToHex(int n) { } +int getInt(char character) { + if(character == '0') return character; + else return '1'; +} + PascalString bitwiseDualAnd(PascalString a, PascalString b) { PascalString result = {a.length, '0'}; for(int i = b.length; i >= 0; --i) { if(a.length < i) result.characters[i] = a.characters[i]; - println("i: ", i, " ", a.characters[i] & b.characters[i]); - result.characters[i] = a.characters[i] & b.characters[i]; + println("i: ", i, " ", intToHexChar(getInt(a.characters[i]) & getInt(b.characters[i]))); + result.characters[i] = intToHexChar(getInt(a.characters[i]) & getInt(b.characters[i])); } return result;