Files
TI-Studium-Mitschriften/Semester 4/MICONT/Aufgabenblätter/ZickZack/main.c
2025-07-02 13:08:03 +02:00

50 lines
969 B
C
Executable File
Raw Blame History

// Clear screen and set cursor home
#include <stdio.h>
#include <serIO.h>
unsigned char taste;
void indentWithSpace(int amount) {
int g;
for (g = 0; g < (amount); g++)
serCharOut(' '); // indenting
return;
}
void drawChristmastree(int width) {
int i;
int j;
for (i = 0; i < width; i++) {
indentWithSpace((width-i));
for (j = 0; j < ((2 * i) + 1); j++) { // draws '='
if (i > 0) serCharOut('=');
}
serCharOut('\n');
indentWithSpace(width);
serCharOut('='); // Stamm
serCharOut('\n');
}
}
void main() {
int hasChar = 0;
serInit();
while(hasChar == 0) {
taste = serIn();
if (taste != '\0') {
hasChar = 1;
break;
}
drawChristmastree(40);
}
return;
}
/* Gedanken zur Funktionalen Aufteilung und Erweiterung
- eigenst<73>ndige Funktion zum indenten ; Parameter: (int Anzahl ' ' (LEERZEICHEN))
- recursivit<69>t hier besonders interessant zum Zeichnen der Charakterketten Parameter: (int Schleifendurchl<68>ufe)
*/