diff --git a/02_MENT/a.out b/02_MENT/a.out index aacdc59..f49d944 100755 Binary files a/02_MENT/a.out and b/02_MENT/a.out differ diff --git a/02_MENT/limits.out b/02_MENT/limits.out index e3a35a4..fdc07bd 100755 Binary files a/02_MENT/limits.out and b/02_MENT/limits.out differ diff --git a/02_MENT/main_02_MENT.cpp b/02_MENT/main_02_MENT.cpp index faf6262..d3316e2 100644 --- a/02_MENT/main_02_MENT.cpp +++ b/02_MENT/main_02_MENT.cpp @@ -23,21 +23,35 @@ return value; } int hexStringToInt(PascalString binaryDigits) { -int returnValue = -1; +int returnValue = 0; + +for(int i = 0; i <= binaryDigits.length; ++i) { + returnValue += binaryDigits.characters[i]; +} return returnValue; } + + +void printPascalString(PascalString s) { + for(int i = 0; i <= s.length; i++) { + println(s.characters[i]); + } +} + int main(int argc, char** argv, char** envp) { PascalString s = {3, '1', '0', '0'}; PascalString s2 = {4, 'f', 'f', 'f', 'f'}; println(hexStringToInt(s)); println(hexStringToInt(s2)); - - println(hexDigitToInt('D')); + println(hexDigitToInt('d')); println(hexDigitToInt('9')); println(hexDigitToInt('2')); + + printPascalString(s2); + return 0; } diff --git a/02_MENT/println.out b/02_MENT/println.out index 82e5fb3..b1bbd0f 100755 Binary files a/02_MENT/println.out and b/02_MENT/println.out differ