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

18
C/c00/ex00/ft_putchar.c Normal file
View File

@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:47:36 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:39:47 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:49:41 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:42:13 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_alphabet(void)
{
char a;
a = 'a';
while ('z' >= a)
{
write(1, &a, 1);
a++;
}
}

Binary file not shown.

View File

@ -0,0 +1,23 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_reverse_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:52:57 by cchauvet #+# #+# */
/* Updated: 2022/07/14 13:54:25 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_print_alphabet(void)
{
char a;
a = 'z';
while (a >= 'a')
{
write(1, &a, 1);
a--;
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_numbers.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:55:25 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:45:15 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_print_numbers(void)
{
char a;
a = '0';
while ('9' >= a)
{
write(1, &a, 1);
a++;
}
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_negative.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 14:14:39 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:51:31 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_is_negative(int n)
{
char a;
a = 'N';
if (n > 0)
{
a = 'P';
}
write(1, &a, 1);
}

View File

@ -0,0 +1,54 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 14:18:48 by cchauvet #+# #+# */
/* Updated: 2022/07/14 15:10:35 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_result(char x, char y, char z)
{
ft_putchar(x);
ft_putchar(y);
ft_putchar(z);
if (!((x == '7') && (y == '8') && (z == '9')))
{
ft_putchar(',');
ft_putchar(' ');
}
}
void ft_print_comb(void)
{
char x;
char y;
char z;
x = '0';
while (x <= '7')
{
y = x + 1;
while (y <= '8')
{
z = y + 1;
while (z <= '9')
{
ft_result(x, y, z);
z++;
}
y++;
}
x++;
}
}

View File

@ -0,0 +1,81 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 13:08:46 by cchauvet #+# #+# */
/* Updated: 2022/07/14 14:25:34 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include <stdbool.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
bool ft_sames(char a, char b, char c, char d)
{
char e;
b = a;
if (e != b)
return (false);
e = b;
if (e != c)
return (false);
e = c;
if (e != d)
return (false);
return (true);
}
void ft_result(char a, char b, char c, char d)
{
if (!ft_sames(a, b, c, d))
{
ft_putchar(a);
ft_putchar(b);
ft_putchar(' ');
ft_putchar(c);
ft_putchar(d);
if (!((a == '9') && (b == '8') && (c == '9') && (d == '9')))
{
ft_putchar(',');
ft_putchar(' ');
}
}
}
void ft_print_comb2(void)
{
char a;
char b;
char c;
char d;
a = '0';
while (a <= '9')
{
b = '0';
while (b <= '8')
{
c = '0';
while (c <= '9')
{
d = '0';
while (d <= '9')
{
ft_result(a, b, c, d++);
}
c++;
}
b++;
}
a++;
}
}

36
C/c00/ex07/ft_putnbr.c Normal file
View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 16:46:16 by cchauvet #+# #+# */
/* Updated: 2022/07/14 16:52:22 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char a)
{
write(1, &a, 1);
}
void ft_putnbr(int nb)
{
if (nb < 0)
{
ft_putchar('-');
ft_putnbr(-nb);
}
else if (nb > 10)
{
ft_putnbr(nb / 10);
ft_putchar(nb % 10 + 48);
}
else
{
ft_putchar(nb + 48);
}
}

View File

@ -0,0 +1,4 @@
void ft_print_combn(int n)
{
}