diff --git a/01_ENV/a.out b/01_ENV/a.out index 9793008..8959975 100755 Binary files a/01_ENV/a.out and b/01_ENV/a.out differ diff --git a/01_ENV/func1.o b/01_ENV/func1.o index 00b78d5..68c0170 100644 Binary files a/01_ENV/func1.o and b/01_ENV/func1.o differ diff --git a/01_ENV/main.o b/01_ENV/main.o index 7d29e16..4f83c68 100644 Binary files a/01_ENV/main.o and b/01_ENV/main.o differ diff --git a/02_MENT/a.out b/02_MENT/a.out index bb90f23..6ce0451 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 fdc07bd..080e0a5 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 99fd0b8..185eb92 100644 --- a/02_MENT/main_02_MENT.cpp +++ b/02_MENT/main_02_MENT.cpp @@ -23,13 +23,13 @@ return value; } int hexStringToInt(PascalString binaryDigits) { -int returnValue = 0; + int returnValue = 0; -for(int i = 0; i <= binaryDigits.length; ++i) { - returnValue += binaryDigits.characters[i]; -} + for(int i = 0; i <= binaryDigits.length; ++i) { + returnValue += binaryDigits.characters[i]; + } -return returnValue; + return returnValue; } @@ -40,11 +40,22 @@ void printPascalString(PascalString s) { } } -int intToDual(int n) { +PascalString intToDual(int n) { + int i = std::to_string(n).length() * 4; + PascalString string = {i}; + while(n >= 1) { + string.characters[i] = (n % 2) + '0'; + n = n / 2; + i--; + } + + + return string; } int main(int argc, char** argv, char** envp) { + PascalString s = {3, '1', '0', '0'}; PascalString s2 = {4, 'f', 'f', 'f', 'f'}; println(hexStringToInt(s)); @@ -64,6 +75,8 @@ int main(int argc, char** argv, char** envp) { println(controlRegister); + printPascalString(intToDual(41)); + return 0; } diff --git a/02_MENT/println.out b/02_MENT/println.out index b1bbd0f..8c522bc 100755 Binary files a/02_MENT/println.out and b/02_MENT/println.out differ