-
Notifications
You must be signed in to change notification settings - Fork 0
/
rush00.c
53 lines (48 loc) · 1.43 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rush00.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fatmaozturk <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/19 11:10:48 by fatmaozturk #+# #+# */
/* Updated: 2022/03/19 11:14:32 by fatmaozturk ### ########.tr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void rush(int x, int y)
{
int n;
int m;
m = x;
n = y;
if (x < 1 || y < 1)
return ;
while (y > 0)
{
while (x > 0)
{
if ((x == 1 && 1 < y && y < n) || (x == m && 1 < y && y < n))
ft_putchar('|');
else if ((y == 1 && 1 < x && x < m) || (y == n && 1 < x && x < m))
ft_putchar('-');
else if (x != 1 && y != 1 && x != m && y != n)
ft_putchar(' ');
else
ft_putchar('o');
x--;
}
y--;
ft_putchar('\n');
x = m;
}
}
int main(void)
{
rush(4, 4);
return (0);
}