From 27f17ea96b1377f3c4fdc3b815479c1840e6bfe5 Mon Sep 17 00:00:00 2001 From: joethei Date: Sun, 7 Oct 2018 14:39:52 +0200 Subject: [PATCH] =?UTF-8?q?03=5FFLOW=5FMP:=20fertig=2002=5FMENT=5FTestat:?= =?UTF-8?q?=20zur=C3=BCckgesetzt=2003=5FFLOW=5FTestat:=20zur=C3=BCckgesetz?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/02_MENT/Testat/main_02_MENT.cpp | 31 ---------- src/03_FLOW/MP/main_mp2_FLOW_a.cpp | 12 ++-- src/03_FLOW/Testat/main_mp2_FLOW_a.cpp | 82 +------------------------- 3 files changed, 8 insertions(+), 117 deletions(-) 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