ajout abs, greater, smaller, sign
This commit is contained in:
6
Makefile
6
Makefile
@@ -102,7 +102,11 @@ SRCS = ft_memset.c \
|
|||||||
ft_next_word.c \
|
ft_next_word.c \
|
||||||
ft_convert.c \
|
ft_convert.c \
|
||||||
ft_flag_transform.c \
|
ft_flag_transform.c \
|
||||||
ft_flag_transform_bonus.c
|
ft_flag_transform_bonus.c \
|
||||||
|
ft_abs.c \
|
||||||
|
ft_greater.c \
|
||||||
|
ft_smaller.c \
|
||||||
|
ft_sign.c
|
||||||
|
|
||||||
|
|
||||||
ODIR = ./builds
|
ODIR = ./builds
|
||||||
|
|||||||
@@ -107,6 +107,10 @@ void ft_putnbrendl(int n);
|
|||||||
void ft_putnbrendl_fd(int n, int fd);
|
void ft_putnbrendl_fd(int n, int fd);
|
||||||
int ft_get_next_line(const int fd, char **line);
|
int ft_get_next_line(const int fd, char **line);
|
||||||
char *ft_concat_free(char *str1, char *str2);
|
char *ft_concat_free(char *str1, char *str2);
|
||||||
|
int ft_abs(int n);
|
||||||
|
int ft_greater(int a, int b);
|
||||||
|
int ft_smaller(int a, int b);
|
||||||
|
int ft_sign(int i);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
8
srcs/ft_abs.c
Normal file
8
srcs/ft_abs.c
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_abs(int n)
|
||||||
|
{
|
||||||
|
if (n < 0)
|
||||||
|
n *= -1;
|
||||||
|
return (n);
|
||||||
|
}
|
||||||
8
srcs/ft_greater.c
Normal file
8
srcs/ft_greater.c
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_greater(int a, int b)
|
||||||
|
{
|
||||||
|
if (a < b)
|
||||||
|
return (b);
|
||||||
|
return (a);
|
||||||
|
}
|
||||||
8
srcs/ft_sign.c
Normal file
8
srcs/ft_sign.c
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_sign(int i)
|
||||||
|
{
|
||||||
|
if (i < 0)
|
||||||
|
return (-1);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
8
srcs/ft_smaller.c
Normal file
8
srcs/ft_smaller.c
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_smaller(int a, int b)
|
||||||
|
{
|
||||||
|
if (a > b)
|
||||||
|
return (b);
|
||||||
|
return (a);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user