diff --git a/src/02_MENT/Testat/main_02_MENT.cpp b/src/02_MENT/Testat/main_02_MENT.cpp index 5ca37c4..64551eb 100644 --- a/src/02_MENT/Testat/main_02_MENT.cpp +++ b/src/02_MENT/Testat/main_02_MENT.cpp @@ -1,6 +1,3 @@ -// file: main_02_MENT.cpp -// THIS IS C++, use clang++ - #include #include "../../helpers/println.hpp" @@ -18,35 +15,7 @@ void printPascalString(PascalString s) { } -PascalString bitwiseDualOr(PascalString a, PascalString b) { - - PascalString shortString = a.length <= b.length ? a : b; - PascalString longString = a.length <= b.length ? b : a; - - PascalString result = {longString.length}; - - for(int i = 1; i <= shortString.length; ++i) { - result.characters[result.length -i] = longString.characters[longString.length -i] | shortString.characters[shortString.length -i]; - //println(result.length -i, ": ",result.characters[result.length -i]," l=",longString.length -i, ":",longString.characters[longString.length -i]," s=",shortString.length -i,":", shortString.characters[shortString.length -i]); - } - for(int i = (longString.length - shortString.length)-1; i >= 0 ; --i) { - result.characters[i] = longString.characters[i]; - //println(i, ": ", result.characters[i]); - } - - return result; -} - - int main(int argc, char** argv, char** envp) { - - printPascalString(bitwiseDualOr({2, '0', '1'}, {2, '1', '0'})); - printPascalString(bitwiseDualOr({2, '0', '1'}, {3, '1', '1', '1'})); - printPascalString(bitwiseDualOr({3, '1', '1', '1'}, {4, '1', '1', '0', '1'})); - printPascalString(bitwiseDualOr({3, '0', '0', '0'}, {5, '1', '1', '0', '1', '0'})); - printPascalString(bitwiseDualOr({3, '0', '1', '1'}, {6, '1', '1', '0', '1', '0', '1'})); - printPascalString(bitwiseDualOr({2, '0', '1'}, {6, '1', '1', '0', '1', '0', '1'})); - printPascalString(bitwiseDualOr({2, '1', '1'}, {6, '1', '0', '0', '1', '0', '0'})); return 0; } diff --git a/src/03_FLOW/MP/main_mp2_FLOW_a.cpp b/src/03_FLOW/MP/main_mp2_FLOW_a.cpp index f43cfc6..88efb2a 100644 --- a/src/03_FLOW/MP/main_mp2_FLOW_a.cpp +++ b/src/03_FLOW/MP/main_mp2_FLOW_a.cpp @@ -18,11 +18,13 @@ void mod1a() { PRINT; } } - - - void mod2() { - + INITPRINT("Modification 2"); + for(int i = 0; i < 2; i++) { + PRINT; + PRINT; + for(int i = 0; i < 4; i++) { PRINT;} + } } @@ -30,7 +32,7 @@ int main(int argc, const char * argv[]) { console.clearScreen(); currentColor = Colors::BLUE; mod1(); - currentColor = Colors::RED; + currentColor = Colors::GREEN; mod2(); diff --git a/src/03_FLOW/Testat/main_mp2_FLOW_a.cpp b/src/03_FLOW/Testat/main_mp2_FLOW_a.cpp index cb84102..2ee00c1 100644 --- a/src/03_FLOW/Testat/main_mp2_FLOW_a.cpp +++ b/src/03_FLOW/Testat/main_mp2_FLOW_a.cpp @@ -7,66 +7,8 @@ int currentTick; Colors currentColor; #define INITPRINT(label) {firstLine=__LINE__;console.printText(2*currentTick,0,label,Colors::BLACK);} #define PRINT printLineNumber(__LINE__) - void printLineNumber(int lineNumber); -void help(int i); - -void help2(); - -void recurse2(int i, int rounds); - - -void recurse2(int i, int rounds) { - if (i == 0 && rounds == 2) { - help2(); - } else if (i == 0 && rounds == 1) { - recurse2(3, 0); - } else { recurse2((i - 1), 2); } - -} - -void help2() { - PRINT; - recurse2(3, 1); - PRINT; -} - - -void recurse(int i) { - if (i == 0) { - help(2); - return; - } - PRINT; - recurse(i - 1); -} - -void help(int i) { - if (i % 2 == 0)PRINT; - else { - PRINT; - recurse(3); - } -} - - -void iterationA(int x) { - for (int i = 0; i < 3; ++i) - PRINT; - if (x % 2 != 0) - PRINT; - else - PRINT; -} - -void startA() { - iterationA(1); - iterationA(2); - iterationA(3); - iterationA(4); -} - int main(int argc, const char *argv[]) { @@ -74,24 +16,9 @@ int main(int argc, const char *argv[]) { currentColor = Colors::GREEN; - /* - * 1x Rekursion - * 1x Selektion - * 1x Subroutine - * - * 3x Aufrufe aus: - * 1x Rekursion - * 1x Hilfsfunktion - * 1x main - */ - - startA(); - //recurse2(3, 2); - std::string s; std::cin >> s; - return 0; } @@ -100,11 +27,4 @@ void printLineNumber(int lineNumber) { std::string line = std::to_string(lineNumber); currentTick++; console.printText(currentTick * 2 - 1, 1 + lineNumber - firstLine, line, currentColor); -} - - -/*void printLineNumber(int lineNumber){ - std::string line = std::to_string(lineNumber); - console.printText(currentTick*2, 1+lineNumber-firstLine, line, currentColor); - currentTick++; -}*/ \ No newline at end of file +} \ No newline at end of file