-
Notifications
You must be signed in to change notification settings - Fork 0
/
rush00.c
78 lines (70 loc) · 1.55 KB
/
rush00.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rush00.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ttshabal <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/02/18 07:56:40 by ttshabal #+# #+# */
/* Updated: 2018/02/18 09:37:17 by ttshabal ### ########.fr */
/* */
/* ************************************************************************** */
void ft_putchar(char c);
void width(int x)
{
int i;
i = 1;
if (x == 1)
ft_putchar('o');
if (x > 1)
{
ft_putchar('o');
while (i <= x)
{
if (i < (x - 1))
ft_putchar('-');
i++;
}
ft_putchar('o');
}
ft_putchar('\n');
}
void bottom_half(int x, int y)
{
int i;
i = 1;
if (y > 1)
{
if (x != 1)
ft_putchar('|');
while (i <= x)
{
if (i < (x - 1))
ft_putchar(' ');
if (i == x)
ft_putchar('|');
i++;
}
}
ft_putchar('\n');
}
void vertical(int x, int y)
{
int i;
i = 1;
while (i < y - 1)
{
bottom_half(x, y);
i++;
}
}
void rush(int a, int b)
{
if (a > 0 && b > 0)
{
width(a);
vertical(a, b);
if (b > 1)
width(a);
}
}