C_CPP/src/03_FLOW/Testat/main_mp2_FLOW_a.cpp

82 lines
1.4 KiB
C++

#include <stdio.h> /* file main_mp2_FLOW_a.cpp */
#include "../../helpers/AnsiConsole.h"
AnsiConsole console;
int firstLine;
int currentTick;
Colors currentColor;
#define INITPRINT(label) {firstLine=__LINE__;console.printText(2*currentTick,0,label,Colors::WHITE);}
#define PRINT printLineNumber(__LINE__)
void printLineNumber(int lineNumber);
void b();void asub();void csub();void c();
void d() {
INITPRINT("c");
c();
}
void csub() {
for(int i = 0; i <= 2; i++) {
PRINT;
}
}
void a() {
INITPRINT("a");
asub();PRINT;asub();PRINT;asub();PRINT;
}
void b() {
INITPRINT("b");
for(int i = 0; i <= 4; i++) {
if(i % 2) {
asub();PRINT;}
else {
asub();PRINT;
}
}
}
void c() {
for(int i = 0; i <= 4; i++) {
if(i % 2) {
csub();PRINT;}
else {
csub();PRINT;
}
}
}
void asub() {
for(int i = 0; i <= 2; i++) {
PRINT;
}
}
int main(int argc, const char *argv[]) {
console.clearScreen();
currentColor = Colors::GREEN;
//a();
//b();
d();
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);
}