0
0
This commit is contained in:
Guy Baconniere
2021-08-20 10:02:38 +02:00
parent 5aa02c94b5
commit d30270c485
354 changed files with 0 additions and 0 deletions

35
C_00/git/ex07/ft_putnbr.c Normal file
View File

@@ -0,0 +1,35 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/05 18:09:22 by gbaconni #+# #+# */
/* Updated: 2021/08/06 11:48:21 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putnbr(int nb)
{
char str[10];
int i;
i = 0;
if (nb == 0)
write(1, "0", 1);
while (nb != 0)
{
str[i] = nb % 10 + '0';
nb /= 10;
i++;
}
while (i > 0)
{
--i;
if (str[i] >= 48 && str[i] <= 57)
write(1, &str[i], 1);
}
}

28
C_00/git/ex07/main.c Normal file
View File

@@ -0,0 +1,28 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/05 18:07:44 by gbaconni #+# #+# */
/* Updated: 2021/08/06 11:48:27 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
int main(void)
{
void ft_putnbr(int nb);
ft_putnbr(-1);
write(1, "\n", 1);
ft_putnbr(0);
write(1, "\n", 1);
ft_putnbr(42);
write(1, "\n", 1);
ft_putnbr(2147483647);
return (0);
}

6
C_00/git/ex07/main.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
norminette -R CheckForbiddenSourceHeader
gcc -Wall -Wextra -Werror -o a.out *.c
echo $(basename $PWD):
./a.out
rm -f a.out