Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_strrev.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: msabwat <marvin@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/08/08 21:01:05 by msabwat #+# #+# */
- /* Updated: 2017/08/08 21:23:06 by msabwat ### ########.fr */
- /* */
- /* ************************************************************************** */
- char *ft_strrev(char *str)
- {
- int i;
- int j;
- i = 0;
- j = 0;
- while (str[i])
- {
- i++;
- }
- while (i >= 0)
- {
- str[i] = str[;
- i--;
- j++;
- }
- return (str);
- }
- int main()
- {
- ft_strrev("testota");
- return (0);
- }
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- /* ************************************************************************** */
- ft_strlen.c
- e2r10p19% cd ..
- e2r10p19% ls
- ex00 ex01 ex02 ex03 ex04 ex05 ex06
- e2r10p19% mkdir ft_strrev.c
- e2r10p19% rm ft_strrev.c
- rm: ft_strrev.c: is a directory
- e2r10p19% rm -r ft_strrev.c
- e2r10p19% ls
- ex00 ex01 ex02 ex03 ex04 ex05 ex06
- e2r10p19% mkdir ex07
- e2r10p19% ls
- ex00 ex01 ex02 ex03 ex04 ex05 ex06 ex07
- e2r10p19% git add.
- git: 'add.' is not a git command. See 'git --help'.
- Did you mean this?
- add
- e2r10p19% git add .
- e2r10p19% git log
- commit bc8621a0a645c3e64e0485a363048d5e21c66190
- Author: Mehdi m'hamed SABWAT <msabwat@e1r2p13.42.fr>
- Date: Mon Aug 7 22:24:43 2017 +0200
- premiers pas
- e2r10p19% git status
- On branch master
- Your branch is up-to-date with 'origin/master'.
- Changes to be committed:
- (use "git reset HEAD <file>..." to unstage)
- renamed: ft_ft.c -> ex00/ft_ft.c
- new file: ex01/ft_ultimate_ft.c
- new file: ex02/ft_swap.c
- new file: ex03/ft_div_mod.c
- new file: ex04/ft_ultimate_div_mod.c
- new file: ex05/ft_putstr.c
- new file: ex06/ft_strlen.c
- e2r10p19% git commit -m "avancement... ATTENTION pas verifie la norminette"
- [master 388fa44] avancement... ATTENTION pas verifie la norminette
- Committer: Mehdi m'hamed SABWAT <msabwat@e2r10p19.42.fr>
- Your name and email address were configured automatically based
- on your username and hostname. Please check that they are accurate.
- You can suppress this message by setting them explicitly. Run the
- following command and follow the instructions in your editor to edit
- your configuration file:
- git config --global --edit
- After doing this, you may fix the identity used for this commit with:
- git commit --amend --reset-author
- 7 files changed, 126 insertions(+), 3 deletions(-)
- rename ft_ft.c => ex00/ft_ft.c (84%)
- create mode 100644 ex01/ft_ultimate_ft.c
- create mode 100644 ex02/ft_swap.c
- create mode 100644 ex03/ft_div_mod.c
- create mode 100644 ex04/ft_ultimate_div_mod.c
- create mode 100644 ex05/ft_putstr.c
- create mode 100644 ex06/ft_strlen.c
- e2r10p19% git push
- vogsphere: (INFO) Transaction ID : 308efbac-6df8-4b21-a04e-615cb0e6b542
- vogsphere: (INFO) Please mention this ID in any ticket you create concerning this transaction
- vogsphere: (INFO) This transaction has been started at 2017-08-08 20:56:40, server time.
- vogsphere: (INFO) Rights will be determined using this time, so do NOT cut the connection.
- vogsphere: (INFO) It appears you are msabwat. If that's not true, check your Kerberos tickets (klist)
- vogsphere: (INFO) You have read and write rights on this repository
- Counting objects: 16, done.
- Delta compression using up to 4 threads.
- Compressing objects: 100% (9/9), done.
- Writing objects: 100% (16/16), 1.59 KiB | 0 bytes/s, done.
- Total 16 (delta 6), reused 0 (delta 0)
- To vogsphere.42.fr:intra/2017/activities/piscine_c_day_03/msabwat
- bc8621a..388fa44 master -> master
- e2r10p19% ls
- ex00 ex01 ex02 ex03 ex04 ex05 ex06 ex07
- e2r10p19% cd ex07
- e2r10p19% ls
- source /Users/msabwat/42-correction-jhalford/jhalford-corr-install.sh
- e2r10p19% ls
- e2r10p19% vim ft_strrev.c
- e2r10p19% git add .
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_strrev.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: msabwat <marvin@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/08/08 21:01:05 by msabwat #+# #+# */
- /* Updated: 2017/08/08 22:01:09 by msabwat ### ########.fr */
- /* */
- /* ************************************************************************** */
- char *ft_strrev(char *str)
- {
- int i;
- char *tab;
- i = 0;
- j = 0;
- while (str[i])
- {
- i++;
- }
- while (i >= 0)
- {
- }
- return (str);
- }
- int main()
- {
- ft_strrev("testota");
- return (0);
- }
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ft_strrev.c [+] 26,3-9 All
- -- INSERT --
- Session Restored
- Last login: Wed Aug 9 11:32:14 on console
- e1r2p3% atoi lkjhr98mnb88
- zsh: command not found: atoi
- e1r2p3% atoi man
- zsh: command not found: atoi
- e1r2p3% man atoi
- e1r2p3% atoi "jhkjhd545758kjhd54"
- zsh: command not found: atoi
- e1r2p3% atoi("jhkjhd545758kjhd54")
- zsh: unknown file attribute: j
- e1r2p3% atoi("545758")
- zsh: no matches found: atoi(545758)
- e1r2p3% clear
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ft_strrev.c 29,6-12 All
- "ft_strrev.c" 38L, 1138C written
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_strrev.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: msabwat <marvin@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/08/08 21:01:05 by msabwat #+# #+# */
- /* Updated: 2017/08/09 12:07:34 by msabwat ### ########.fr */
- /* */
- /* ************************************************************************** */
- char *ft_strrev(char *str)
- {
- int i;
- int j;
- char *revstr;
- i = 0;
- j = 0;
- while (str[i])
- {
- i++;
- }
- while (i >= 0 && j < i)
- {
- revstr[j] = str[i];
- i--;
- j++;
- }
- return (str);
- }
- int main()
- {
- ft_strrev("testota");
- return (0);
- }
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ft_strrev.c 29,6-12 All
- 1 /* ************************************************************** ************ */
- 2 /* */
- 3 /* ::: :::::::: */
- 4 /* ft_strrev.c :+: :+: :+: */
- 5 /* +:+ +:+ +:+ */
- 6 /* By: msabwat <marvin@42.fr> +#+ +:+ +#+ */
- 7 /* +#+#+#+#+#+ + #+ */
- 8 /* Created: 2017/08/08 21:01:05 by msabwat #+# #+# */
- 9 /* Updated: 2017/08/09 12:59:23 by msabwat ### ##### ###.fr */
- 10 /* */
- 11 /* ************************************************************** ************ */
- 12
- 13 #include <unistd.h>
- 14
- 15 void ft_putstr(char *str);
- 16
- 17 int ft_putchar(char c)
- 18 {
- 19 write(1, &c, 1);
- 20 return (0);
- 21 }
- 22
- 23 char *ft_strrev(char *str)
- 24 {
- 25 int i;
- 26 int j;
- 27
- 28 i = 0;
- 29 j = 0;
- 30 while (str[i])
- 31 {
- 32 i++;
- 33 }
- 34 char revstr[i];
- 35 while (i >= 0 )
- 36 {
- 37 revstr[j] = str[i];
- 38 ft_putchar(revstr[j]);
- 39 i--;
- 40 j++;
- 41 ft_putchar(i + 48);
- 42 ft_putchar(j + 48);
- 43 }
- 44 return (str);
- 45 }
- 46
- 47 int main()
- 48 {
- 49 char *string;
- 50
- 51 string = "testota";
- 52 ft_strrev(string);
- 53 ft_putstr(string);
- 54 return (0);
- 55 }
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ft_strrev.c 37,2-8 All
- "ft_strrev.c" 55L, 1365C written
- Session Restored
- Last login: Wed Aug 9 14:37:01 on console
- e1r2p3% ls
- a.out ft_putstr.c ft_strrev.c
- e1r2p3% ls
- a.out ft_putstr.c ft_strrev.c
- e1r2p3% clear
- /* ************************************************************************** e1r2p3% ls
- a.out ft_putstr.c ft_strrev.c
- e1r2p3% vim ft_putstr.c
- e1r2p3% vim ft_strrev.c
- e1r2p3% cat ft_strrev.c
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_strrev.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: msabwat <marvin@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/08/08 21:01:05 by msabwat #+# #+# */
- /* Updated: 2017/08/09 16:29:29 by msabwat ### ########.fr */
- /* */
- /* ************************************************************************** */
- /* ************************************************************************** #include <unistd.h>
- #include <stdio.h>
- void ft_putstr(char *str);
- int ft_putchar(char c)
- {
- write(1, &c, 1);
- return (0);
- }
- char *ft_strrev(char *str)
- {
- int i;
- int j;
- char temp;
- i = 0;
- j = 0;
- while (str[i])
- {
- i++;
- }
- j = i - 1;
- i = 0;
- while (j > i)
- {
- temp = str[i];
- str[i] = str[j];
- str[j] = temp;
- i++;
- j--;
- //ft_putchar(i + 48);
- //ft_putchar(j + 48);
- //ft_putchar(temp);
- }
- return (str);
- }
- int main()
- {
- char str[] = "defghj";
- printf("%s", ft_strrev(str));
- return (0);
- }
- e1r2p3% cat ft_putstr.c
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_putstr.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: msabwat <marvin@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/08/08 19:43:42 by msabwat #+# #+# */
- /* Updated: 2017/08/08 20:48:39 by msabwat ### ########.fr */
- /* */
- /* ************************************************************************** */
- void ft_putchar(char c);
- void ft_putstr(char *str)
- {
- int i;
- i = 0;
- while (str[i])
- {
- ft_putchar(str[i]);
- i++;
- }
- }
- e1r2p3% vim ft_strrev.c
- e1r2p3% ls
- ft_strrev.c
- e1r2p3% cd ../ex08
- e1r2p3% ls
- e1r2p3% clear
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_atoi.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: msabwat <marvin@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/08/09 17:00:50 by msabwat #+# #+# */
- /* Updated: 2017/08/09 17:40:18 by msabwat ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include <stdio.h>
- #include <unistd.h>
- #include <stdlib.h>
- int ft_putchar(char c)
- {
- write(1, &c,1);
- return (0);
- }
- int ft_atoi(char *str)
- {
- int i;
- i = 0;
- while (str[i])
- {
- ft_putchar(str[i]);
- i++;
- }
- return (0);
- }
- int main()
- {
- printf("%d", atoi(" +65"));
- //printf("%d", ft_atoi(" +65"));
- ft_putchar('\n');
- printf("%d", atoi(" -986hgd69"));
- printf("%d", ft_atoi(" -986hgd69"));
- printf("%d", atoi("kjhcu54657c5465cds-+654"));
- printf("%d", ft_atoi("kjhcu54657c5465cds-+654"));
- printf("%d", atoi("32"));
- printf("%d", ft_atoi("32"));
- printf("%d", atoi("-457-24"));
- printf("%d", ft_atoi("-457-24"));
- return (0);
- }
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- ft_atoi.c 48,2 All
- -- VISUAL -- 37
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement