aboutsummaryrefslogtreecommitdiff
path: root/exam00/rendu
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-07-16 12:58:13 +0200
committerCharles <sircharlesaze@gmail.com>2019-07-16 12:58:13 +0200
commit14914f50c3de6c5444e13cf67db064b03c1c90ef (patch)
tree3ecf5a41b4541980ba0287a431681cd5ae25ad84 /exam00/rendu
parent217bcb0d4e3ba60604921cb40d5a11a64f93cfc7 (diff)
downloadpiscine-14914f50c3de6c5444e13cf67db064b03c1c90ef.tar.gz
piscine-14914f50c3de6c5444e13cf67db064b03c1c90ef.tar.bz2
piscine-14914f50c3de6c5444e13cf67db064b03c1c90ef.zip
c09 passed, c10 start, exam00 and exam01
Diffstat (limited to 'exam00/rendu')
-rwxr-xr-xexam00/rendu/__GIT_HISTORY71
-rwxr-xr-xexam00/rendu/ft_atoi/ft_atoi.c60
-rwxr-xr-xexam00/rendu/ft_countdown/ft_countdown.c20
-rwxr-xr-xexam00/rendu/ft_putstr/ft_putstr.c10
-rwxr-xr-xexam00/rendu/ft_strrev/ft_strrev.c31
-rwxr-xr-xexam00/rendu/maff_alpha/maff_alpha.c21
-rwxr-xr-xexam00/rendu/only_z/only_z.c8
7 files changed, 221 insertions, 0 deletions
diff --git a/exam00/rendu/__GIT_HISTORY b/exam00/rendu/__GIT_HISTORY
new file mode 100755
index 0000000..4ce38dc
--- /dev/null
+++ b/exam00/rendu/__GIT_HISTORY
@@ -0,0 +1,71 @@
+commit 4933249a7abc3ae2a2f34fa94bc39fc25b94037e
+Author: Exam 42 <exam-no-reply@42.fr>
+Date: Fri Jul 5 20:42:29 2019 +0200
+
+ there is still a main you idiot
+
+ ft_atoi/ft_atoi.c | 5 -----
+ 1 file changed, 5 deletions(-)
+
+commit aee71077430e4cb04d7151c5422572a6ccd97167
+Author: Exam 42 <exam-no-reply@42.fr>
+Date: Fri Jul 5 20:37:38 2019 +0200
+
+ exam00 ft_atoi
+
+ ft_atoi/ft_atoi.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 65 insertions(+)
+
+commit a39f6ce8235aec04c798cf602000ab71a8be0361
+Author: Exam 42 <exam-no-reply@42.fr>
+Date: Fri Jul 5 19:25:56 2019 +0200
+
+ ft_strrev return corr
+
+ ft_strrev/ft_strrev.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit d7079124e81f8d1d030d31f59ca1fa2a1e2eb8f9
+Author: Exam 42 <exam-no-reply@42.fr>
+Date: Fri Jul 5 19:23:52 2019 +0200
+
+ exam00 ft_strrev
+
+ ft_strrev/ft_strrev.c | 31 +++++++++++++++++++++++++++++++
+ 1 file changed, 31 insertions(+)
+
+commit 9a061d46ec225b60d5798839c9343d3dcb47a21e
+Author: Exam 42 <exam-no-reply@42.fr>
+Date: Fri Jul 5 18:57:38 2019 +0200
+
+ exam00 ft_putstr
+
+ ft_putstr/ft_putstr.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+commit cf5957fe28f503c7637a640ca229743385364c1d
+Author: Exam 42 <exam-no-reply@42.fr>
+Date: Fri Jul 5 18:47:39 2019 +0200
+
+ exam00 maff_alpha.c
+
+ maff_alpha/maff_alpha.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+commit 1bff6951e5d37fb9f911e6cf93afdb9a2a079a64
+Author: Exam 42 <exam-no-reply@42.fr>
+Date: Fri Jul 5 18:38:16 2019 +0200
+
+ exam00 ft_countdown
+
+ ft_countdown/ft_countdown.c | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+commit 1ea27768767e32d773e78820d481b20a4d108c5b
+Author: Exam 42 <exam-no-reply@42.fr>
+Date: Fri Jul 5 18:23:38 2019 +0200
+
+ exam only_z
+
+ only_z/only_z.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
diff --git a/exam00/rendu/ft_atoi/ft_atoi.c b/exam00/rendu/ft_atoi/ft_atoi.c
new file mode 100755
index 0000000..81f0706
--- /dev/null
+++ b/exam00/rendu/ft_atoi/ft_atoi.c
@@ -0,0 +1,60 @@
+char ctoi(char c)
+{
+ return (c - '0');
+}
+
+int ft_strlen(const char *str)
+{
+ int counter;
+
+ counter = 0;
+ while (*str >= '0' && *str <= '9')
+ {
+ counter++;
+ str++;
+ }
+ return (counter);
+}
+
+int pow10(int exponent)
+{
+ int accumulator;
+
+ accumulator = 1;
+ while (exponent > 0)
+ {
+ accumulator *= 10;
+ exponent--;
+ }
+ return (accumulator);
+}
+
+int ft_atoi(const char *str)
+{
+ int nb;
+ int i;
+ int is_negative;
+
+ while (*str == ' ' || *str == '\t'|| *str == '\n'
+ || *str == '\v'|| *str == '\f'|| *str == '\r')
+ str++;
+ if (*str == '-')
+ is_negative = 1;
+ else
+ is_negative = 0;
+ if (*str == '-' || *str == '+')
+ {
+ str++;
+ }
+ nb = 0;
+ i = ft_strlen(str) - 1;
+ while (*str >= '0' && *str <= '9')
+ {
+ nb += pow10(i) * ctoi(*str);
+ i--;
+ str++;
+ }
+ if (is_negative)
+ nb = -nb;
+ return (nb);
+}
diff --git a/exam00/rendu/ft_countdown/ft_countdown.c b/exam00/rendu/ft_countdown/ft_countdown.c
new file mode 100755
index 0000000..67861c6
--- /dev/null
+++ b/exam00/rendu/ft_countdown/ft_countdown.c
@@ -0,0 +1,20 @@
+#include <unistd.h>
+
+void ft_putchar(char c)
+{
+ write(1, &c, 1);
+}
+
+int main(void)
+{
+ char a;
+
+ a = '9';
+ while (a >= '0')
+ {
+ ft_putchar(a);
+ a--;
+ }
+ ft_putchar('\n');
+}
+
diff --git a/exam00/rendu/ft_putstr/ft_putstr.c b/exam00/rendu/ft_putstr/ft_putstr.c
new file mode 100755
index 0000000..aea8468
--- /dev/null
+++ b/exam00/rendu/ft_putstr/ft_putstr.c
@@ -0,0 +1,10 @@
+#include <unistd.h>
+
+void ft_putstr(char *str)
+{
+ while (*str)
+ {
+ write(1, str, 1);
+ str++;
+ }
+}
diff --git a/exam00/rendu/ft_strrev/ft_strrev.c b/exam00/rendu/ft_strrev/ft_strrev.c
new file mode 100755
index 0000000..ef58887
--- /dev/null
+++ b/exam00/rendu/ft_strrev/ft_strrev.c
@@ -0,0 +1,31 @@
+int ft_strlen(char *str)
+{
+ int counter;
+
+ counter = 0;
+ while (*str)
+ {
+ counter++;
+ str++;
+ }
+ return (counter);
+}
+
+char *ft_strrev(char *str)
+{
+ int i;
+ int j;
+ char tmp;
+
+ i = 0;
+ j = ft_strlen(str) - 1;
+ while (i <= j)
+ {
+ tmp = str[i];
+ str[i] = str[j];
+ str[j] = tmp;
+ i++;
+ j--;
+ }
+ return (str);
+}
diff --git a/exam00/rendu/maff_alpha/maff_alpha.c b/exam00/rendu/maff_alpha/maff_alpha.c
new file mode 100755
index 0000000..416dc0d
--- /dev/null
+++ b/exam00/rendu/maff_alpha/maff_alpha.c
@@ -0,0 +1,21 @@
+#include <unistd.h>
+
+void ft_putchar(char c)
+{
+ write(1, &c, 1);
+}
+
+int main(void)
+{
+ char ch = 'a';
+ while (ch <= 'z')
+ {
+ if (ch % 2 == 0)
+ ft_putchar(ch - 'a' + 'A');
+ else
+ ft_putchar(ch);
+ ch++;
+ }
+ ft_putchar('\n');
+ return 0;
+}
diff --git a/exam00/rendu/only_z/only_z.c b/exam00/rendu/only_z/only_z.c
new file mode 100755
index 0000000..08ab66b
--- /dev/null
+++ b/exam00/rendu/only_z/only_z.c
@@ -0,0 +1,8 @@
+#include <unistd.h>
+
+int main(void)
+{
+ char z = 'z';
+ write(1, &z, 1);
+ return 0;
+}