This commit is contained in:
Camille Chauvet
2023-05-17 16:45:25 +00:00
commit 29ed24d567
619 changed files with 16119 additions and 0 deletions

View File

@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ft.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 15:22:16 by cchauvet #+# #+# */
/* Updated: 2022/07/14 18:33:56 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_ft(int *nbr)
{
*nbr = 42;
}

View File

@ -0,0 +1,16 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ultimate_ft.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 18:27:16 by cchauvet #+# #+# */
/* Updated: 2022/07/14 18:53:31 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_ultimate_ft(int *********nbr)
{
*********nbr = 42;
}

View File

@ -0,0 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_swap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 18:46:50 by cchauvet #+# #+# */
/* Updated: 2022/07/15 10:51:16 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_swap(int *a, int *b)
{
int tempo;
tempo = *a;
*a = *b;
*b = tempo;
}

View File

@ -0,0 +1,17 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_div_mod.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 18:58:15 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:35:36 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_div_mod(int a, int b, int *div, int *mod)
{
*div = a / b;
*mod = a % b;
}

View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ultimate_div_mod.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 10:37:49 by cchauvet #+# #+# */
/* Updated: 2022/07/19 19:06:46 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_ultimate_div_mod(int *a, int *b)
{
int c;
int d;
c = *a / *b;
d = *a % *b;
*a = c;
*b = d;
}

View File

@ -0,0 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 19:06:11 by cchauvet #+# #+# */
/* Updated: 2022/07/14 19:18:13 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putstr(char *str)
{
while (*str != 0)
{
write(1, str++, 1);
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 19:06:11 by cchauvet #+# #+# */
/* Updated: 2022/07/18 10:34:56 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
int ft_strlen(char *str)
{
int a;
a = 0;
while (*str != 0)
{
a++;
str++;
}
return (a);
}

View File

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rev_int_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/15 09:31:51 by cchauvet #+# #+# */
/* Updated: 2022/07/15 10:54:35 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_swap(int *a, int *b)
{
int tempo;
tempo = *a;
*a = *b;
*b = tempo;
}
void ft_rev_int_tab(int *tab, int size)
{
int i;
i = 0;
while (i < size / 2)
{
ft_swap(tab + i, tab + size - i - 1);
i++;
}
}

BIN
Correction/C01/ex08/a.out Executable file

Binary file not shown.

View File

@ -0,0 +1,52 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_int_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/19 19:08:01 by cchauvet #+# #+# */
/* Updated: 2022/07/20 15:41:40 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
void ft_sort_int_tab(int *tab, int size)
{
int i;
int j;
int tempo;
i = 0;
while (i < size)
{
j = 0;
while (j < size - 1)
{
if (tab[j] > tab[j + 1])
{
tempo = tab[j];
tab[j] = tab[j + 1];
tab[j + 1] = tempo;
}
j++;
}
i++;
}
}
#include <stdio.h>
int main()
{
int tab[] = {6,-5,9,3,2,1};
int i = 0;
ft_sort_int_tab(tab, 6);
while (i < 6)
{
printf("%d,", tab[i]);
i++;
}
}