From 39efce229f48a768afb51e6d680ff475ad43a28f Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Fri, 31 Aug 2018 14:05:18 +0200 Subject: [PATCH] =?UTF-8?q?kleinere=20=C3=84nderungen=20die=20noch=20nicht?= =?UTF-8?q?s=20bringen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03_FLOW_a/Testat/main_mp2_FLOW_a.cpp | 13 +++++-------- 04_UDEF/MP/main_04_UDEF_e.cpp | 14 +++++++++++--- 05_OO/MP/shapes_main.cpp | 1 - 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/03_FLOW_a/Testat/main_mp2_FLOW_a.cpp b/03_FLOW_a/Testat/main_mp2_FLOW_a.cpp index 04829db..238f0cf 100644 --- a/03_FLOW_a/Testat/main_mp2_FLOW_a.cpp +++ b/03_FLOW_a/Testat/main_mp2_FLOW_a.cpp @@ -21,11 +21,8 @@ void recurse2(int i, int rounds) { } else if(i == 0 && rounds == 1) { recurse2(3, 0); - } - else - return; + }else {recurse2((i-1), 2);} - PRINT;recurse2(i-1, 2); } void help2() {PRINT; recurse2(3, 1); @@ -36,7 +33,7 @@ void help2() {PRINT; void recurse(int i) { if(i == 0) {help(2); return;} - PRINT;recurse(i-1);return; + PRINT;recurse(i-1); } void help(int i) {if(i % 2 == 0)PRINT; else { @@ -81,8 +78,8 @@ int main(int argc, const char * argv[]) { * 1x main */ - //startA(); - recurse2(3, 2); + startA(); + //recurse2(3, 2); std::string s; std::cin >> s; @@ -104,4 +101,4 @@ 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 diff --git a/04_UDEF/MP/main_04_UDEF_e.cpp b/04_UDEF/MP/main_04_UDEF_e.cpp index 7820b24..55e2e7f 100644 --- a/04_UDEF/MP/main_04_UDEF_e.cpp +++ b/04_UDEF/MP/main_04_UDEF_e.cpp @@ -44,7 +44,8 @@ bool operator!=(BinaryOctet a, BinaryOctet b) { return true; } -BinaryOctet operator--(BinaryOctet &id, int) { +const BinaryOctet operator--(BinaryOctet &id, int) { + return id; } @@ -64,8 +65,12 @@ BinaryOctet operator/(BinaryOctet a, BinaryOctet b) { } -BinaryOctet& BinaryOctet::operator=(int const &i) { - init(i); +BinaryOctet& BinaryOctet::operator=(int const &a) { + std::cout << a << std::endl; + std::string tmp = to_string(a); + for(int i = 0; i < bitsPerOctet; i++) { + bitsAsDigits[i] = tmp[i]; + } return *this; } @@ -99,6 +104,9 @@ std::ostream& operator<< (std::ostream& os, const BinaryOctet &toBePrinted){ int main(int argc, char **argv) { BinaryOctet a = 0b00001111; BinaryOctet b = 0b00000110; + std::cout << a << std::endl; + BinaryOctet c = 00001111; + std::cout << c << std::endl; std::cout << new BinaryOctet(5) << std::endl; println(a + b); std::cout << a + b << std::endl; diff --git a/05_OO/MP/shapes_main.cpp b/05_OO/MP/shapes_main.cpp index 3e74716..62d3c50 100644 --- a/05_OO/MP/shapes_main.cpp +++ b/05_OO/MP/shapes_main.cpp @@ -39,7 +39,6 @@ class Point : public Shape{ public: explicit Point(int x, int y, Colors color); - void draw() override; };