Piscine42

This commit is contained in:
2023-12-12 17:25:55 +01:00
commit e07184f084
62 changed files with 1572 additions and 0 deletions

25
C02/ex00/ft_strcpy.c Executable file
View File

@@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/07 12:44:06 by fgras-ca #+# #+# */
/* Updated: 2022/12/10 10:29:05 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strcpy(char *dest, char *src)
{
int i;
i = 0;
while (src[i] != '\0')
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
return (dest);
}

29
C02/ex01/ft_strncpy.c Executable file
View File

@@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/07 13:20:04 by fgras-ca #+# #+# */
/* Updated: 2022/12/10 16:55:53 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
unsigned int i;
i = 0;
while (src[i] != '\0' && i < n)
{
dest[i] = src[i];
i++;
}
while (i < n)
{
dest[i] = '\0';
i++;
}
return (dest);
}

BIN
C02/ex02/.main.c.swp Executable file

Binary file not shown.

34
C02/ex02/ft_str_is_alpha.c Executable file
View File

@@ -0,0 +1,34 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_alpha.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/07 14:06:49 by fgras-ca #+# #+# */
/* Updated: 2022/12/10 17:05:15 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_alpha(char *str)
{
int i;
i = 0;
if (str[i] == '\0')
{
return (1);
}
while (str[i] != '\0')
{
if ((str[i] >= 65 && str[i] <= 90) || (str[i] >= 97 && str[i] <= 122))
{
i++;
}
else
{
return (0);
}
}
return (1);
}

34
C02/ex03/ft_str_is_numeric.c Executable file
View File

@@ -0,0 +1,34 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_numeric.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/07 17:46:52 by fgras-ca #+# #+# */
/* Updated: 2022/12/10 17:06:15 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_numeric(char *str)
{
int i;
i = 0;
if (str[i] == '\0')
{
return (1);
}
while (str[i] != '\0')
{
if ((str[i] >= 48 && str[i] <= 57))
{
i++;
}
else
{
return (0);
}
}
return (1);
}

34
C02/ex04/ft_str_is_lowercase.c Executable file
View File

@@ -0,0 +1,34 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_lowercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/07 18:03:49 by fgras-ca #+# #+# */
/* Updated: 2022/12/07 18:11:53 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_lowercase(char *str)
{
int i;
i = 0;
if (str[i] == '\0')
{
return (1);
}
while (str[i] != '\0')
{
if ((str[i]) >= 97 && (str[i] <= 122))
{
i++;
}
else
{
return (0);
}
}
return (1);
}

34
C02/ex05/ft_str_is_uppercase.c Executable file
View File

@@ -0,0 +1,34 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_uppercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/07 18:13:20 by fgras-ca #+# #+# */
/* Updated: 2022/12/08 08:12:15 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_uppercase(char *str)
{
int i;
i = 0;
if (str[i] == 0)
{
return (1);
}
while (str[i] != '\0')
{
if ((str[i] >= 65 && str[i] <= 90))
{
i++;
}
else
{
return (0);
}
}
return (1);
}

30
C02/ex06/ft_str_is_printable.c Executable file
View File

@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_printable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/07 18:30:32 by fgras-ca #+# #+# */
/* Updated: 2022/12/08 08:26:33 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_printable(char *str)
{
int i;
i = 0;
while (str[i] != '\0')
{
if ((str[i] >= 32 && str[i] <= 126))
{
i++;
}
else
{
return (0);
}
}
return (1);
}

BIN
C02/ex07/.main.c.swo Executable file

Binary file not shown.

25
C02/ex07/ft_strupcase.c Executable file
View File

@@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strupcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/08 08:28:11 by fgras-ca #+# #+# */
/* Updated: 2022/12/10 11:01:18 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strupcase(char *str)
{
int i;
i = 0;
while (str[i] != '\0')
{
if ((str[i] >= 97 && str[i] <= 122))
str[i] -= 32;
i++;
}
return (str);
}

BIN
C02/ex08/.main.c.swp Executable file

Binary file not shown.

25
C02/ex08/ft_strlowcase.c Executable file
View File

@@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlowcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/08 10:34:31 by fgras-ca #+# #+# */
/* Updated: 2022/12/08 10:44:36 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strlowcase(char *str)
{
int i;
i = 0;
while (str[i] != '\0')
{
if ((str[i] >= 65 && str[i] <= 90))
str[i] += 32;
i++;
}
return (str);
}

BIN
C02/fr.subject.pdf Normal file

Binary file not shown.