68 lines
1.1 KiB
C
68 lines
1.1 KiB
C
//
|
|
// Created by bruno on 2/5/24.
|
|
//
|
|
|
|
#include "hviezdicky.h"
|
|
#include "stdio.h"
|
|
|
|
void escapeStart(){
|
|
putchar('\033');
|
|
putchar('[');
|
|
}
|
|
|
|
void escapeEnd() {
|
|
putchar('m');
|
|
}
|
|
|
|
void white() {
|
|
escapeStart();
|
|
putchar('3');
|
|
putchar('7');
|
|
putchar(';');
|
|
putchar('4');
|
|
putchar('0');
|
|
escapeEnd();
|
|
}
|
|
|
|
void black() {
|
|
escapeStart();
|
|
putchar('3');
|
|
putchar('0');
|
|
putchar(';');
|
|
putchar('4');
|
|
putchar('7');
|
|
escapeEnd();
|
|
}
|
|
|
|
void original() {
|
|
escapeStart();
|
|
putchar('0');
|
|
escapeEnd();
|
|
}
|
|
|
|
int stars() {
|
|
int j; //stĺpec
|
|
int i; //riadok
|
|
int a; //počet riadkov
|
|
//int b; //počet stĺpcov
|
|
printf("Zadaj počet riadkov:");
|
|
scanf("%d", &a);
|
|
//printf("Zadaj počet stĺpcov:");
|
|
//scanf("%d", &b);
|
|
putchar('\n');
|
|
for (i = 0; i < a; i++) {
|
|
for (j = 0; j < a; j++) {
|
|
if (i % 2 != j % 2) {
|
|
white();
|
|
putchar(' ');
|
|
original();
|
|
} else {
|
|
black();
|
|
putchar(' ');
|
|
original();
|
|
}
|
|
}
|
|
putchar('\n');
|
|
}
|
|
return 0;
|
|
} |