-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelper.c
51 lines (47 loc) · 1 KB
/
helper.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <windows.h>
#include <stdio.h>
#include <locale.h>
void gotoxy(int x, int y)
{
COORD coordinate;
coordinate.X = x;
coordinate.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coordinate);
}
void draw_square_hollow(int x1, int x2, int y1, int y2)
{
int i, j;
// setlocale(LC_CTYPE, "");
for (i = x1; i <= x2; ++i)
{
for (j = y1; j <= y2; ++j)
{
if (i == x1 || i == x2 || j == y1 || j == y2)
{
gotoxy(i, j);
// wprintf(L"\x2588");
printf("█");
}
else
{
gotoxy(i, j);
}
}
gotoxy(i, j);
}
}
void draw_square(int x1, int x2, int y1, int y2)
{
int i, j;
// setlocale(LC_CTYPE, "");
for (i = x1; i <= x2; ++i)
{
for (j = y1; j <= y2; ++j)
{
gotoxy(i, j);
// wprintf(L"\x2588");
printf("█");
}
gotoxy(i, j);
}
}