-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_test.c
76 lines (70 loc) · 1.83 KB
/
ft_test.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_test.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: alahlou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/10/31 19:09:46 by alahlou #+# #+# */
/* Updated: 2015/11/02 00:01:18 by alahlou ### ########.fr */
/* */
/* ************************************************************************** */
#include "my_functions.h"
void ft_test(char *str)
{
int x;
int y;
int colle[5];
x = 0;
y = 0;
while (str[x] != '\0')
{
if (str[x] == '\n')
y++;
x++;
}
x = (x - y) / y;
if (ft_strcmp(back00(x, y), str) == 0)
colle[0] = 1;
if (ft_strcmp(back01(x, y), str) == 0)
colle[1] = 1;
if (ft_strcmp(back02(x, y), str) == 0)
colle[2] = 1;
if (ft_strcmp(back03(x, y), str) == 0)
colle[3] = 1;
if (ft_strcmp(back04(x, y), str) == 0)
colle[4] = 1;
ft_put_colle(colle, x, y);
}
void ft_print_error(void)
{
ft_putstr("aucune\n");
}
void ft_put_colle(int *colle, int x, int y)
{
int i;
int nbc;
i = 0;
nbc = colle[0] + colle[1] + colle[2] + colle[3] + colle[4];
if (nbc == 0)
ft_print_error();
while (i != 5)
{
if (colle[i] == 1)
{
ft_putstr("[colle-0");
ft_putchar(i + 48);
ft_putstr("] [");
ft_putnbr(x);
ft_putstr("] [");
ft_putnbr(y);
ft_putchar(']');
if (nbc >= 2)
{
ft_putstr(" || ");
nbc++;
}
}
i++;
}
}