update to local git repo
This commit is contained in:
50
Semester 4/MICONT/Aufgabenblätter/ZickZack/main.c
Executable file
50
Semester 4/MICONT/Aufgabenblätter/ZickZack/main.c
Executable file
@@ -0,0 +1,50 @@
|
||||
// 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)
|
||||
*/
|
||||
Reference in New Issue
Block a user