2018-04-25 14:00:57 +02:00
|
|
|
#include <stdio.h> /* file main_mp2_FLOW_a.cpp */
|
2018-08-19 18:48:08 +02:00
|
|
|
#include "../../helpers/AnsiConsole.h"
|
2018-04-25 14:00:57 +02:00
|
|
|
|
|
|
|
AnsiConsole console; int firstLine; 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();
|
2018-08-19 18:48:08 +02:00
|
|
|
void recurse2(int i, int rounds);
|
2018-04-25 14:00:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-06 17:57:51 +02:00
|
|
|
void recurse2(int i, int rounds) {
|
|
|
|
if(i == 0 && rounds == 2) {
|
|
|
|
help2();
|
|
|
|
}
|
|
|
|
else if(i == 0 && rounds == 1) {
|
|
|
|
recurse2(3, 0);
|
2018-08-31 14:05:18 +02:00
|
|
|
}else {recurse2((i-1), 2);}
|
2018-05-06 17:57:51 +02:00
|
|
|
|
2018-04-25 14:00:57 +02:00
|
|
|
}
|
|
|
|
void help2() {PRINT;
|
2018-05-06 17:57:51 +02:00
|
|
|
recurse2(3, 1);
|
2018-04-25 14:00:57 +02:00
|
|
|
PRINT;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void recurse(int i) {
|
|
|
|
if(i == 0) {help(2); return;}
|
2018-08-31 14:05:18 +02:00
|
|
|
PRINT;recurse(i-1);
|
2018-04-25 14:00:57 +02:00
|
|
|
}
|
|
|
|
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[]) {
|
|
|
|
|
|
|
|
console.clearScreen();
|
|
|
|
|
|
|
|
currentColor = Colors::GREEN;
|
2018-05-06 17:57:51 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 1x Rekursion
|
|
|
|
* 1x Selektion
|
|
|
|
* 1x Subroutine
|
|
|
|
*
|
|
|
|
* 3x Aufrufe aus:
|
|
|
|
* 1x Rekursion
|
|
|
|
* 1x Hilfsfunktion
|
|
|
|
* 1x main
|
|
|
|
*/
|
|
|
|
|
2018-08-31 14:05:18 +02:00
|
|
|
startA();
|
|
|
|
//recurse2(3, 2);
|
2018-04-25 14:00:57 +02:00
|
|
|
|
|
|
|
std::string s;
|
|
|
|
std::cin >> s;
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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++;
|
2018-08-31 14:05:18 +02:00
|
|
|
}*/
|