Exos
This commit is contained in:
18
ex0/ft_putchar.c
Normal file
18
ex0/ft_putchar.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putchar.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/03/04 09:24:28 by lclerel- #+# #+# */
|
||||||
|
/* Updated: 2026/03/04 14:03:05 by lclerel- ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_putchar(char c)
|
||||||
|
{
|
||||||
|
write(1, &c, 1);
|
||||||
|
}
|
||||||
18
ex1/ft_print_alphabet.c
Normal file
18
ex1/ft_print_alphabet.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_print_alphabet.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/03/04 09:53:03 by lclerel- #+# #+# */
|
||||||
|
/* Updated: 2026/03/04 14:06:37 by lclerel- ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_print_alphabet(void)
|
||||||
|
{
|
||||||
|
write(1, "abcdefghijklmnopqrstuvwxyz", 26);
|
||||||
|
}
|
||||||
18
ex2/ft_print_reverse_alphabet.c
Normal file
18
ex2/ft_print_reverse_alphabet.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_print_reverse_alphabet.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/03/04 13:27:15 by lclerel- #+# #+# */
|
||||||
|
/* Updated: 2026/03/04 13:48:03 by lclerel- ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_print_reverse_alphabet(void)
|
||||||
|
{
|
||||||
|
write(1, "zyxwvutsrqponmlkjihgfedcba", 26);
|
||||||
|
}
|
||||||
18
ex3/ft_print_numbers.c
Normal file
18
ex3/ft_print_numbers.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_print_numbers.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/03/04 10:06:13 by lclerel- #+# #+# */
|
||||||
|
/* Updated: 2026/03/04 14:08:05 by lclerel- ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_print_numbers(void)
|
||||||
|
{
|
||||||
|
write(1, "0123456789", 10);
|
||||||
|
}
|
||||||
28
ex4/ft_is_negative.c
Normal file
28
ex4/ft_is_negative.c
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_is_negative.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lclerel- <lclerel-@learner.42.tech> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/03/04 10:08:57 by lclerel- #+# #+# */
|
||||||
|
/* Updated: 2026/03/04 16:11:32 by lclerel- ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void ft_is_negative(int n)
|
||||||
|
{
|
||||||
|
char c;
|
||||||
|
|
||||||
|
if (n >= 0)
|
||||||
|
{
|
||||||
|
c = 'P';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c = 'N';
|
||||||
|
}
|
||||||
|
write(1, &c, 1);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user