-
Notifications
You must be signed in to change notification settings - Fork 0
/
rush04.c
91 lines (82 loc) · 2.01 KB
/
rush04.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rush04.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dpetrosy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/05 20:50:01 by dpetrosy #+# #+# */
/* Updated: 2022/02/05 20:51:22 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 = 'B';
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 letter_a;
char letter_c;
char letter_b;
letter_a = 'A';
letter_c = 'C';
letter_b = 'B';
if (i == 1)
{
display_up_line(j, J);
}
else if (i == I)
{
if (j == 1)
ft_putchar(letter_c);
else if (j == J)
ft_putchar(letter_a);
else
ft_putchar(letter_b);
}
}
void display_up_line(int j, int J)
{
char letter_a;
char letter_b;
char letter_c;
letter_a = 'A';
letter_b = 'B';
letter_c = 'C';
if (j == 1)
ft_putchar(letter_a);
else if (j == J)
ft_putchar(letter_c);
else
ft_putchar(letter_b);
}