-
Notifications
You must be signed in to change notification settings - Fork 0
/
rush01.c
91 lines (82 loc) · 1.99 KB
/
rush01.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rush01.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dpetrosy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/05 17:48:54 by dpetrosy #+# #+# */
/* Updated: 2022/02/06 19:28:48 by dpetrosy ### ########.fr */
/* */
/* ************************************************************************** */
void ft_putchar(const char c);
void fill_rectangle(int i, int j, int I, int J);
void up_down_line(int i, int j, int I, int J);
void display_up_line(int j, int J);
void rush(const int J, const int I)
{
int i;
int j;
i = 0;
while (++i <= I)
{
j = 0;
while (++j <= J)
{
fill_rectangle(i, j, I, J);
up_down_line(i, j, I, J);
}
ft_putchar('\n');
}
}
void fill_rectangle(int i, int j, int I, int J)
{
char symbol;
char space;
symbol = '*';
space = ' ';
if (i != 1 && i != I)
{
if (j == 1 || j == J)
ft_putchar(symbol);
else
ft_putchar(space);
}
}
void up_down_line(int i, int j, int I, int J)
{
char slash;
char backslash;
char symbol;
slash = '/';
backslash = '\\';
symbol = '*';
if (i == 1)
{
display_up_line(j, J);
}
else if (i == I)
{
if (j == 1)
ft_putchar(backslash);
else if (j == J)
ft_putchar(slash);
else
ft_putchar(symbol);
}
}
void display_up_line(int j, int J)
{
char slash;
char backslash;
char symbol;
slash = '/';
backslash = '\\';
symbol = '*';
if (j == 1)
ft_putchar(slash);
else if (j == J)
ft_putchar(backslash);
else
ft_putchar(symbol);
}