Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alison Felix De Araujo Maia committed Jan 4, 2024
1 parent cffe5e2 commit 59ca458
Show file tree
Hide file tree
Showing 93 changed files with 4,022 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Piscine/C00/ex00/ft_putchar.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: afelix-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/13 15:38:43 by afelix-d #+# #+# */
/* Updated: 2023/12/14 12:37:23 by afelix-d ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>

void ft_putchar(char c)
{
write(1, &c, 1);
}
/*
int main(void)
{
ft_putchar('A');
return (0);
}
*/
37 changes: 37 additions & 0 deletions Piscine/C00/ex01/ft_print_alphabet.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: afelix-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/14 11:14:17 by afelix-d #+# #+# */
/* Updated: 2023/12/14 12:31:49 by afelix-d ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>

void ft_putchar(char c)
{
write(1, &c, 1);
}

void ft_print_alphabet(void)
{
char i;

i = 'a';
while (i <= 'z')
{
ft_putchar(i);
i++;
}
}
/*
int main(void)
{
ft_print_alphabet();
return (0);
}
*/
37 changes: 37 additions & 0 deletions Piscine/C00/ex02/ft_print_reverse_alphabet.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_reverse_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: afelix-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/14 11:14:17 by afelix-d #+# #+# */
/* Updated: 2023/12/14 12:34:05 by afelix-d ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>

void ft_putchar(char c)
{
write(1, &c, 1);
}

void ft_print_reverse_alphabet(void)
{
char i;

i = 'z';
while (i >= 'a')
{
ft_putchar(i);
i--;
}
}
/*
int main(void)
{
ft_print_reverse_alphabet();
return (0);
}
*/
37 changes: 37 additions & 0 deletions Piscine/C00/ex03/ft_print_numbers.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_numbers.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: afelix-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/14 11:14:17 by afelix-d #+# #+# */
/* Updated: 2023/12/14 12:34:53 by afelix-d ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>

void ft_putchar(char c)
{
write(1, &c, 1);
}

void ft_print_numbers(void)
{
char i;

i = '0';
while (i <= '9')
{
ft_putchar(i);
i++;
}
}
/*
int main(void)
{
ft_print_numbers();
return (0);
}
*/
33 changes: 33 additions & 0 deletions Piscine/C00/ex04/ft_is_negative.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_negative.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: afelix-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/14 12:14:48 by afelix-d #+# #+# */
/* Updated: 2023/12/14 12:35:42 by afelix-d ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>

void ft_putchar(char c)
{
write(1, &c, 1);
}

void ft_is_negative(int n)
{
if (n < 0)
ft_putchar('N');
else
ft_putchar('P');
}
/*
int main(void)
{
ft_is_negative(9);
return (0);
}
*/
49 changes: 49 additions & 0 deletions Piscine/C00/ex05/ft_print_comb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: afelix-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/14 12:14:48 by afelix-d #+# #+# */
/* Updated: 2023/12/15 12:27:51 by afelix-d ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>

void ft_print_comb(void)
{
char d1;
char d2;
char d3;

d1 = '0';
while (d1 <= '7')
{
d2 = d1 + 1;
while (d2 <= '8')
{
d3 = d2 + 1;
while (d3 <= '9')
{
write(1, &d1, 1);
write(1, &d2, 1);
write(1, &d3, 1);
if (d1 < '7')
write(1, ", ", 2);
d3++;
}
d2++;
}
d1++;
}
write(1, "\n", 1);
}
/*
int main(void)
{
ft_print_comb();
return (0);
}
*/
59 changes: 59 additions & 0 deletions Piscine/C00/ex06/ft_print_comb2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: afelix-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/14 12:14:48 by afelix-d #+# #+# */
/* Updated: 2023/12/15 13:44:26 by afelix-d ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>

void ft_print_comb(int n1, int n2)
{
int d1;
int d2;
int d3;
int d4;

d1 = 48 + n1 / 10;
d2 = 48 + n1 % 10;
d3 = 48 + n2 / 10;
d4 = 48 + n2 % 10;
write(1, &d1, 1);
write(1, &d2, 1);
write(1, " ", 1);
write(1, &d3, 1);
write(1, &d4, 1);
if (n1 < 98)
write(1, ", ", 2);
}

void ft_print_comb2(void)
{
int n1;
int n2;

n1 = 0;
while (n1 <= 98)
{
n2 = n1 + 1;
while (n2 <= 99)
{
ft_print_comb(n1, n2);
n2++;
}
n1++;
}
write(1, "\n", 1);
}
/*
int main(void)
{
ft_print_comb2();
return (0);
}
*/
47 changes: 47 additions & 0 deletions Piscine/C00/ex07/ft_putnbr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: afelix-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/17 13:42:44 by afelix-d #+# #+# */
/* Updated: 2023/12/17 14:06:57 by afelix-d ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>

void ft_putnbr(int nb)
{
int n;

if (nb == -2147483648)
{
write(1, "-2", 2);
ft_putnbr(147483648);
}
else if (nb < 0)
{
write(1, "-", 1);
nb = -nb;
ft_putnbr(nb);
}
else if (nb > 9)
{
ft_putnbr(nb / 10);
ft_putnbr(nb % 10);
}
else
{
n = nb + 48;
write(1, &n, 1);
}
}
/*
int main(void)
{
ft_putnbr(537);
return (0);
}
*/
57 changes: 57 additions & 0 deletions Piscine/C01/ex00/ft_ft.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ft.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: afelix-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/17 15:27:38 by afelix-d #+# #+# */
/* Updated: 2023/12/17 15:43:11 by afelix-d ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>
/*
void ft_putnbr(int nb)
{
int n;
if (nb == -2147483648)
{
write(1, "-2", 2);
ft_putnbr(147483648);
}
else if (nb < 0)
{
write(1, "-", 1);
nb = -nb;
ft_putnbr(nb);
}
else if (nb > 9)
{
ft_putnbr(nb / 10);
ft_putnbr(nb % 10);
}
else
{
n = nb + 48;
write(1, &n, 1);
}
}
*/
void ft_ft(int *nbr)
{
*nbr = 42;
}
/*
int main(void)
{
int a;
int *pa;
a = 137;
pa = &a;
ft_ft(pa);
return (0);
}
*/
Loading

0 comments on commit 59ca458

Please sign in to comment.