├── .system ├── acceptCGV ├── .devmake.err ├── exam_token │ ├── .settings │ └── .demo_token ├── data_sender.sh ├── a.out ├── checkreadline.cpp ├── qrcode └── exercise.hpp ├── .subjects ├── STUD_PART │ ├── exam_02 │ │ ├── 0 │ │ │ ├── fizzbuzz │ │ │ │ ├── .DS_Store │ │ │ │ ├── tester.sh │ │ │ │ ├── fizzbuzz.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── ft_swap │ │ │ │ ├── .DS_Store │ │ │ │ ├── ft_swap.c │ │ │ │ ├── tester.sh │ │ │ │ ├── attachment │ │ │ │ │ └── subject.en.txt │ │ │ │ └── main.c │ │ │ ├── rot_13 │ │ │ │ ├── .DS_Store │ │ │ │ ├── rot_13.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── rotone │ │ │ │ ├── .DS_Store │ │ │ │ ├── rotone.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── first_word │ │ │ │ ├── .DS_Store │ │ │ │ ├── first_word.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── ft_strcpy │ │ │ │ ├── .DS_Store │ │ │ │ ├── ft_strcpy.c │ │ │ │ ├── main.c │ │ │ │ ├── attachment │ │ │ │ │ └── subject.en.txt │ │ │ │ └── tester.sh │ │ │ ├── ft_strlen │ │ │ │ ├── .DS_Store │ │ │ │ ├── ft_strlen.c │ │ │ │ ├── attachment │ │ │ │ │ └── subject.en.txt │ │ │ │ ├── main.c │ │ │ │ └── tester.sh │ │ │ ├── rev_print │ │ │ │ ├── .DS_Store │ │ │ │ ├── rev_print.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── repeat_alpha │ │ │ │ ├── .DS_Store │ │ │ │ ├── repeat_alpha.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── search_and_replace │ │ │ │ ├── .DS_Store │ │ │ │ └── search_and_replace.c │ │ │ ├── ft_putstr │ │ │ │ ├── main.c │ │ │ │ ├── attachment │ │ │ │ │ └── subject.en.txt │ │ │ │ └── tester.sh │ │ │ └── ulstr │ │ │ │ └── ulstr.c │ │ ├── 1 │ │ │ ├── swap_bits │ │ │ │ ├── beta │ │ │ │ ├── swap_bits.c │ │ │ │ ├── main.c │ │ │ │ ├── attachment │ │ │ │ │ └── subject.en.txt │ │ │ │ └── tester.sh │ │ │ ├── union │ │ │ │ ├── beta │ │ │ │ ├── union.c │ │ │ │ └── subject.en.txt │ │ │ ├── camel_to_snake │ │ │ │ ├── beta │ │ │ │ ├── camel_to_snake.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── snake_to_camel │ │ │ │ ├── beta │ │ │ │ ├── snake_to_camel.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── max │ │ │ │ ├── .DS_Store │ │ │ │ ├── max.c │ │ │ │ ├── attachment │ │ │ │ │ └── subject.en.txt │ │ │ │ ├── main.c │ │ │ │ └── tester.sh │ │ │ ├── do_op │ │ │ │ ├── .DS_Store │ │ │ │ └── do_op.c │ │ │ ├── ft_strcspn │ │ │ │ ├── .DS_Store │ │ │ │ ├── main.c │ │ │ │ ├── attachment │ │ │ │ │ └── subject.en.txt │ │ │ │ ├── ft_strcspn.c │ │ │ │ └── tester.sh │ │ │ ├── ft_strdup │ │ │ │ ├── .DS_Store │ │ │ │ ├── main.c │ │ │ │ ├── attachment │ │ │ │ │ └── subject.en.txt │ │ │ │ ├── ft_strdup.c │ │ │ │ └── tester.sh │ │ │ ├── last_word │ │ │ │ ├── .DS_Store │ │ │ │ ├── last_word.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── alpha_mirror │ │ │ │ ├── .DS_Store │ │ │ │ ├── alpha_mirror.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── is_power_of_2 │ │ │ │ ├── .DS_Store │ │ │ │ ├── is_power_of_2.c │ │ │ │ ├── main.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── ft_atoi │ │ │ │ ├── main.c │ │ │ │ ├── ft_atoi.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── ft_strcmp │ │ │ │ ├── ft_strcmp.c │ │ │ │ ├── main.c │ │ │ │ ├── attachment │ │ │ │ │ └── subject.en.txt │ │ │ │ └── tester.sh │ │ │ ├── print_bits │ │ │ │ ├── print_bits.c │ │ │ │ ├── main.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ └── inter │ │ │ │ ├── inter.c │ │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── 2 │ │ │ ├── lcm │ │ │ │ ├── main.c │ │ │ │ └── lcm.c │ │ │ ├── ft_list_size │ │ │ │ ├── tester.sh │ │ │ │ ├── ft_list_size.c │ │ │ │ ├── main.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── ft_atoi_base │ │ │ │ ├── main.c │ │ │ │ ├── tester.sh │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── paramsum │ │ │ │ ├── paramsum.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── ft_range │ │ │ │ ├── main.c │ │ │ │ ├── ft_range.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── pgcd │ │ │ │ ├── pgcd.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── hidenp │ │ │ │ └── hidenp.c │ │ │ ├── ft_rrange │ │ │ │ ├── ft_rrange.c │ │ │ │ ├── main.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── print_hex │ │ │ │ ├── print_hex.c │ │ │ │ └── attachment │ │ │ │ │ └── subject.en.txt │ │ │ ├── add_prime_sum │ │ │ │ ├── attachment │ │ │ │ │ ├── subject.en.txt │ │ │ │ │ └── subject.fr.txt │ │ │ │ └── tester.sh │ │ │ ├── expand_str │ │ │ │ └── expand_str.c │ │ │ ├── epur_str │ │ │ │ └── epur_str.c │ │ │ └── tab_mult │ │ │ │ ├── tab_mult.c │ │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── 3 │ │ │ ├── flood_fill │ │ │ │ ├── beta │ │ │ │ └── flood_fill.c │ │ │ ├── ft_split │ │ │ │ ├── beta │ │ │ │ ├── main.c │ │ │ │ └── attachment │ │ │ │ │ ├── subject.en.txt │ │ │ │ │ └── subject.pt.txt │ │ │ ├── rev_wstr │ │ │ │ ├── beta │ │ │ │ ├── tester.sh │ │ │ │ └── rev_wstr.c │ │ │ ├── rostring │ │ │ │ └── beta │ │ │ ├── sort_list │ │ │ │ ├── beta │ │ │ │ ├── tester.sh │ │ │ │ └── sort_list.c │ │ │ ├── ft_itoa │ │ │ │ ├── main.c │ │ │ │ ├── attachment │ │ │ │ │ ├── subject.en.txt │ │ │ │ │ └── subject.pt.txt │ │ │ │ ├── tester.sh │ │ │ │ └── ft_itoa.c │ │ │ └── fprime │ │ │ │ └── fprime.c │ │ └── need_correction │ │ │ ├── sort_int_tab │ │ │ ├── attachment │ │ │ │ └── subject.en.txt │ │ │ └── sort_int_tab.c │ │ │ ├── ft_split │ │ │ └── attachment │ │ │ │ ├── subject.en.txt │ │ │ │ └── subject.fr.txt │ │ │ ├── rev_wstr │ │ │ └── rev_wstr.c │ │ │ ├── ft_list_foreach │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ │ └── ft_list_remove_if │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── exam_03 │ │ ├── 0 │ │ │ ├── ft_printf │ │ │ │ └── .DS_Store │ │ │ └── get_next_line │ │ │ │ ├── .DS_Store │ │ │ │ ├── mainboc.c │ │ │ │ └── mainstud.c │ │ └── .DS_Store │ ├── exam_04 │ │ ├── 0 │ │ │ ├── .DS_Store │ │ │ └── microshell │ │ │ │ └── .DS_Store │ │ └── .DS_Store │ ├── exam_05 │ │ ├── 0 │ │ │ ├── .DS_Store │ │ │ └── cpp_module00 │ │ │ │ ├── main.cpp │ │ │ │ ├── Warlock.hpp │ │ │ │ └── Warlock.cpp │ │ ├── 1 │ │ │ ├── .DS_Store │ │ │ └── cpp_module01 │ │ │ │ ├── Dummy.cpp │ │ │ │ ├── Fwoosh.cpp │ │ │ │ ├── Dummy.hpp │ │ │ │ ├── Fwoosh.hpp │ │ │ │ ├── main.cpp │ │ │ │ ├── ATarget.hpp │ │ │ │ ├── ATarget.cpp │ │ │ │ ├── ASpell.hpp │ │ │ │ ├── ASpell.cpp │ │ │ │ └── Warlock.hpp │ │ ├── 2 │ │ │ └── cpp_module02 │ │ │ │ ├── Dummy.cpp │ │ │ │ ├── Fwoosh.cpp │ │ │ │ ├── Dummy.hpp │ │ │ │ ├── Fireball.cpp │ │ │ │ ├── Fwoosh.hpp │ │ │ │ ├── BrickWall.cpp │ │ │ │ ├── Fireball.hpp │ │ │ │ ├── BrickWall.hpp │ │ │ │ ├── Polymorph.cpp │ │ │ │ ├── Polymorph.hpp │ │ │ │ ├── SpellBook.hpp │ │ │ │ ├── ATarget.hpp │ │ │ │ ├── TargetGenerator.hpp │ │ │ │ ├── ATarget.cpp │ │ │ │ ├── ASpell.hpp │ │ │ │ ├── ASpell.cpp │ │ │ │ ├── Warlock.hpp │ │ │ │ └── main.cpp │ │ └── .DS_Store │ └── exam_06 │ │ └── 0 │ │ └── mini_serv │ │ ├── eof_test │ │ ├── catchmsg.sh │ │ ├── test_eof.sh │ │ └── findport.sh └── PISCINE_PART │ ├── exam_03 │ ├── 0 │ │ ├── ft_atoi │ │ │ ├── main.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── swap_bits │ │ │ ├── main.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── reverse_bits │ │ │ ├── main.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── ft_strdup │ │ │ ├── attachment │ │ │ │ └── subject.en.txt │ │ │ └── main.c │ │ ├── inter │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── last_word │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── union │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── 1 │ │ ├── ft_strcmp │ │ │ ├── ft_strcmp.c │ │ │ ├── main.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── ft_strrev │ │ │ ├── main.c │ │ │ ├── ft_strrev.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── wdmatch │ │ │ └── main.c │ │ ├── is_power_of_2 │ │ │ ├── main.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── print_bits │ │ │ ├── main.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── max │ │ │ ├── main.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── alpha_mirror │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── 2 │ │ ├── ft_list_size │ │ │ ├── README.md │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── pgcd │ │ │ ├── examples.txt │ │ │ ├── pgcd.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── hidenp │ │ │ └── examples.txt │ │ ├── epur_str │ │ │ └── attachment │ │ │ │ └── examples.txt │ │ ├── rstr_capitalizer │ │ │ └── attachment │ │ │ │ └── examples.txt │ │ ├── print_hex │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── add_prime_sum │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── ft_rrange │ │ │ └── attachment │ │ │ └── subject.en.txt │ └── 3 │ │ ├── paramsum │ │ └── attachment │ │ │ ├── examples.txt │ │ │ └── subject.en.txt │ │ ├── lcm │ │ ├── lcm.c │ │ └── attachment │ │ │ └── subject.en.txt │ │ ├── tab_mult │ │ └── attachment │ │ │ ├── examples.txt │ │ │ └── subject.en.txt │ │ ├── expand_str │ │ └── attachment │ │ │ └── examples.txt │ │ ├── str_capitalizer │ │ └── attachment │ │ │ └── examples.txt │ │ ├── ft_range │ │ └── attachment │ │ │ └── subject.en.txt │ │ └── ft_atoi_base │ │ └── attachment │ │ └── subject.en.txt │ ├── exam_04 │ ├── 0 │ │ ├── ft_list_size │ │ │ ├── README.md │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── pgcd │ │ │ ├── examples.txt │ │ │ ├── pgcd.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── hidenp │ │ │ └── examples.txt │ │ ├── epur_str │ │ │ └── attachment │ │ │ │ └── examples.txt │ │ ├── rstr_capitalizer │ │ │ └── examples.txt │ │ ├── print_hex │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── add_prime_sum │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── ft_rrange │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── 1 │ │ ├── paramsum │ │ │ └── attachment │ │ │ │ ├── examples.txt │ │ │ │ └── subject.en.txt │ │ ├── lcm │ │ │ ├── lcm.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── tab_mult │ │ │ └── attachment │ │ │ │ ├── examples.txt │ │ │ │ └── subject.en.txt │ │ ├── expand_str │ │ │ └── attachment │ │ │ │ └── examples.txt │ │ ├── str_capitalizer │ │ │ └── examples.txt │ │ ├── ft_range │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── ft_atoi_base │ │ │ └── attachment │ │ │ └── subject.en.txt │ └── 2 │ │ ├── ft_itoa │ │ └── attachment │ │ │ └── subject.en.txt │ │ ├── sort_int_tab │ │ └── attachment │ │ │ └── subject.en.txt │ │ ├── fprime │ │ └── fprime_recursive.c │ │ ├── ft_split │ │ └── attachment │ │ │ └── subject.en.txt │ │ ├── check_mate │ │ └── attachment │ │ │ └── examples.txt │ │ ├── ft_list_foreach │ │ └── attachment │ │ │ └── subject.en.txt │ │ ├── ft_list_remove_if │ │ └── attachment │ │ │ └── subject.en.txt │ │ └── ft_itoa_base │ │ └── attachment │ │ └── subject.en.txt │ ├── .DS_Store │ ├── exam_01 │ ├── 0 │ │ ├── .DS_Store │ │ ├── ft_print_numbers │ │ │ ├── main.c │ │ │ ├── ft_print_numbers.c │ │ │ ├── attachment │ │ │ │ └── subject.en.txt │ │ │ └── tester.sh │ │ ├── ft_countdown │ │ │ ├── ft_countdown.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── aff_a │ │ │ ├── aff_a.c │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── 1 │ │ ├── .DS_Store │ │ ├── hello │ │ │ ├── hello.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── maff_alpha │ │ │ ├── maff_alpha.c │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── 2 │ │ ├── .DS_Store │ │ ├── aff_z │ │ │ ├── aff_z.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── aff_first_param │ │ │ ├── aff_first_param.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── aff_last_param │ │ │ ├── aff_last_param.c │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── 3 │ │ ├── .DS_Store │ │ ├── only_z │ │ │ ├── only_z.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── only_a │ │ │ ├── only_a.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── maff_revalpha │ │ │ ├── maff_revalpha.c │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── 4 │ │ ├── .DS_Store │ │ ├── ft_strlen │ │ │ ├── ft_strlen.c │ │ │ ├── main.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── ft_strcpy │ │ │ ├── ft_strcpy.c │ │ │ ├── main.c │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── 5 │ │ ├── .DS_Store │ │ ├── ulstr │ │ │ └── ulstr.c │ │ ├── search_and_replace │ │ │ └── search_and_replace.c │ │ └── repeat_alpha │ │ │ ├── repeat_alpha.c │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── 6 │ │ ├── .DS_Store │ │ ├── ft_putstr │ │ │ ├── main.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── ft_swap │ │ │ ├── main.c │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── first_word │ │ │ ├── first_word.c │ │ │ └── attachment │ │ │ └── subject.en.txt │ ├── 7 │ │ ├── .DS_Store │ │ ├── rev_print │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ ├── rot_13 │ │ │ └── attachment │ │ │ │ └── subject.en.txt │ │ └── rotone │ │ │ └── attachment │ │ │ └── subject.en.txt │ └── .DS_Store │ └── exam_02 │ ├── 0 │ ├── .DS_Store │ ├── ft_strcpy │ │ ├── .DS_Store │ │ ├── main.c │ │ └── attachment │ │ │ └── subject.en.txt │ ├── ft_strlen │ │ ├── main.c │ │ └── attachment │ │ │ └── subject.en.txt │ └── repeat_alpha │ │ └── attachment │ │ └── subject.en.txt │ ├── 1 │ └── .DS_Store │ ├── 2 │ ├── .DS_Store │ ├── ft_putstr │ │ ├── main.c │ │ └── attachment │ │ │ └── subject.en.txt │ ├── ft_swap │ │ ├── main.c │ │ └── attachment │ │ │ └── subject.en.txt │ └── first_word │ │ ├── first_word.c │ │ └── attachment │ │ └── subject.en.txt │ ├── 3 │ ├── .DS_Store │ ├── rev_print │ │ └── attachment │ │ │ └── subject.en.txt │ ├── rot_13 │ │ └── attachment │ │ │ └── subject.en.txt │ └── rotone │ │ └── attachment │ │ └── subject.en.txt │ ├── 4 │ ├── .DS_Store │ ├── ft_atoi │ │ ├── main.c │ │ └── attachment │ │ │ └── subject.en.txt │ ├── ft_strdup │ │ ├── attachment │ │ │ └── subject.en.txt │ │ └── main.c │ └── inter │ │ └── attachment │ │ └── subject.en.txt │ ├── 5 │ ├── .DS_Store │ ├── swap_bits │ │ ├── main.c │ │ └── attachment │ │ │ └── subject.en.txt │ ├── reverse_bits │ │ ├── main.c │ │ └── attachment │ │ │ └── subject.en.txt │ ├── last_word │ │ └── attachment │ │ │ └── subject.en.txt │ └── union │ │ └── attachment │ │ └── subject.en.txt │ ├── 6 │ ├── .DS_Store │ ├── ft_strcmp │ │ ├── ft_strcmp.c │ │ ├── main.c │ │ └── attachment │ │ │ └── subject.en.txt │ ├── ft_strrev │ │ ├── main.c │ │ ├── ft_strrev.c │ │ └── attachment │ │ │ └── subject.en.txt │ └── alpha_mirror │ │ └── attachment │ │ └── subject.en.txt │ ├── 7 │ ├── .DS_Store │ ├── wdmatch │ │ └── main.c │ ├── is_power_of_2 │ │ ├── main.c │ │ └── attachment │ │ │ └── subject.en.txt │ ├── print_bits │ │ ├── main.c │ │ └── attachment │ │ │ └── subject.en.txt │ └── max │ │ ├── main.c │ │ └── attachment │ │ └── subject.en.txt │ └── .DS_Store └── install.sh /.system/acceptCGV: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /.system/.devmake.err: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.system/exam_token/.settings: -------------------------------------------------------------------------------- 1 | 17 2 | 1 3 | 0 4 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/swap_bits/beta: -------------------------------------------------------------------------------- 1 | Kuninoto -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/union/beta: -------------------------------------------------------------------------------- 1 | Kuninoto -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/flood_fill/beta: -------------------------------------------------------------------------------- 1 | pandalaf -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/ft_split/beta: -------------------------------------------------------------------------------- 1 | pandalaf -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/rev_wstr/beta: -------------------------------------------------------------------------------- 1 | pandalaf -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/rostring/beta: -------------------------------------------------------------------------------- 1 | pandalaf -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/sort_list/beta: -------------------------------------------------------------------------------- 1 | pandalaf -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/camel_to_snake/beta: -------------------------------------------------------------------------------- 1 | Kuninoto -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/snake_to_camel/beta: -------------------------------------------------------------------------------- 1 | Kuninoto -------------------------------------------------------------------------------- /.system/data_sender.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # DATA SENDER REMOVED -------------------------------------------------------------------------------- /.system/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.system/a.out -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/ft_list_size/README.md: -------------------------------------------------------------------------------- 1 | NOT TESTED, POTENTIALLY WRONG 2 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/ft_list_size/README.md: -------------------------------------------------------------------------------- 1 | NOT TESTED, POTENTIALLY WRONG 2 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_03/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_03/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_04/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_04/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_05/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_01/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_02/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_04/0/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_04/0/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/0/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_05/0/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_05/1/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/0/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_01/0/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/1/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_01/1/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/2/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_01/2/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/3/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_01/3/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/4/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_01/4/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/5/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_01/5/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/6/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_01/6/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/7/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_01/7/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/0/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_02/0/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/1/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_02/1/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/2/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_02/2/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/3/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_02/3/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/4/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_02/4/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/5/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_02/5/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/6/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_02/6/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/7/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_02/7/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/max/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/1/max/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/2/aff_z/aff_z.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | write(1, "z\n", 2); 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/3/only_z/only_z.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | write(1, "z", 1); 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/do_op/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/1/do_op/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/3/only_a/only_a.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | write(1, "a", 1); 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/fizzbuzz/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/0/fizzbuzz/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_swap/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/0/ft_swap/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/rot_13/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/0/rot_13/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/rotone/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/0/rotone/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/first_word/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/0/first_word/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_strcpy/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/0/ft_strcpy/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_strlen/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/0/ft_strlen/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/rev_print/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/0/rev_print/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strcspn/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/1/ft_strcspn/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strdup/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/1/ft_strdup/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/last_word/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/1/last_word/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_03/0/ft_printf/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_03/0/ft_printf/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_04/0/microshell/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_04/0/microshell/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/1/hello/hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | write(1, "Hello World!\n", 13); 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/0/ft_strcpy/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/PISCINE_PART/exam_02/0/ft_strcpy/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/repeat_alpha/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/0/repeat_alpha/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/alpha_mirror/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/1/alpha_mirror/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/is_power_of_2/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/1/is_power_of_2/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_03/0/get_next_line/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_03/0/get_next_line/.DS_Store -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_strlen/ft_strlen.c: -------------------------------------------------------------------------------- 1 | int ft_strlen(char *str) 2 | { 3 | int i; 4 | 5 | i = 0; 6 | while (str[i] != '\0') 7 | i++; 8 | return (i); 9 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/search_and_replace/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seraph919/Grademe-edu/HEAD/.subjects/STUD_PART/exam_02/0/search_and_replace/.DS_Store -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/0/ft_print_numbers/main.c: -------------------------------------------------------------------------------- 1 | 2 | void ft_print_numbers(void); 3 | 4 | int main(void) 5 | { 6 | ft_print_numbers(); 7 | return(0); 8 | } 9 | -------------------------------------------------------------------------------- /.system/checkreadline.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | std::cout << "Hello World" << std::endl; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/4/ft_strlen/ft_strlen.c: -------------------------------------------------------------------------------- 1 | int ft_strlen(char *str) 2 | { 3 | int i; 4 | 5 | i = 0; 6 | while(str[i]) 7 | i++; 8 | return (i); 9 | } 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/3/paramsum/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | $>./paramsum 1 2 3 5 7 24 2 | 6 3 | $>./paramsum 6 12 24 | cat -e 4 | 3$ 5 | $>./paramsum | cat -e 6 | 0$ 7 | $> 8 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/1/paramsum/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | $>./paramsum 1 2 3 5 7 24 2 | 6 3 | $>./paramsum 6 12 24 | cat -e 4 | 3$ 5 | $>./paramsum | cat -e 6 | 0$ 7 | $> 8 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/1/maff_alpha/maff_alpha.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | write(1, "aBcDeFgHiJkLmNoPqRsTuVwXyZ\n", 27); 6 | return(0); 7 | } 8 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/swap_bits/swap_bits.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned char swap_bits(unsigned char octet) 4 | { 5 | return ((octet >> 4) | (octet << 4)); 6 | } 7 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/4/ft_atoi/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int ft_atoi(char *s); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | printf("%d",ft_atoi(argv[1])); 8 | return(0); 9 | } 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/ft_atoi/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int ft_atoi(char *s); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | printf("%d",ft_atoi(argv[1])); 8 | return(0); 9 | } 10 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_06/0/mini_serv/eof_test: -------------------------------------------------------------------------------- 1 | Ceci est un test de Ctrl+D dans ton programme ici:\04Si tu ne passes pas ce test, tu devrais verifier le fonctionnement du ctrl+d. 2 | voici 3 | un 4 | nouveau 5 | test -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_swap/ft_swap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void ft_swap(int *a, int *b) 5 | { 6 | int temp; 7 | 8 | temp = *a; 9 | *a = *b; 10 | *b = temp; 11 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_06/0/mini_serv/catchmsg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # close fd before init 4 | exec 6<&- 5 | exec 6 2 | 3 | void ft_putstr(char *str); 4 | 5 | int main (int argc, char **argv) 6 | { 7 | (void)argc; 8 | ft_putstr(argv[1]); 9 | return (0); 10 | } 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/2/ft_putstr/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_putstr(char *str); 4 | 5 | int main (int argc, char **argv) 6 | { 7 | (void)argc; 8 | ft_putstr(argv[1]); 9 | return (0); 10 | } 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/pgcd/examples.txt: -------------------------------------------------------------------------------- 1 | $> ./pgcd 42 10 | cat -e 2 | 2$ 3 | $> ./pgcd 42 12 | cat -e 4 | 6$ 5 | $> ./pgcd 14 77 | cat -e 6 | 7$ 7 | $> ./pgcd 17 3 | cat -e 8 | 1$ 9 | $> ./pgcd | cat -e 10 | $ 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/pgcd/examples.txt: -------------------------------------------------------------------------------- 1 | $> ./pgcd 42 10 | cat -e 2 | 2$ 3 | $> ./pgcd 42 12 | cat -e 4 | 6$ 5 | $> ./pgcd 14 77 | cat -e 6 | 7$ 7 | $> ./pgcd 17 3 | cat -e 8 | 1$ 9 | $> ./pgcd | cat -e 10 | $ 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/ft_itoa/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | char *ft_itoa(int nbr); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | printf("%s\n", ft_itoa(atoi(argv[1]))); 8 | return (0); 9 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/4/ft_strlen/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int ft_strlen(char *str); 4 | 5 | int main (int argc, char **argv) 6 | { 7 | (void)argc; 8 | printf("%d\n", ft_strlen(argv[1])); 9 | return (0); 10 | } 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/0/ft_strlen/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int ft_strlen(char *str); 4 | 5 | int main (int argc, char **argv) 6 | { 7 | (void)argc; 8 | printf("%d\n", ft_strlen(argv[1])); 9 | return (0); 10 | } 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/6/ft_strcmp/ft_strcmp.c: -------------------------------------------------------------------------------- 1 | int ft_strcmp(char *s1, char *s2) 2 | { 3 | int i; 4 | 5 | i = 0; 6 | while (s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0') 7 | i++; 8 | return (s1[i] - s2[i]); 9 | } 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/ft_strcmp/ft_strcmp.c: -------------------------------------------------------------------------------- 1 | int ft_strcmp(char *s1, char *s2) 2 | { 3 | int i; 4 | 5 | i = 0; 6 | while (s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0') 7 | i++; 8 | return (s1[i] - s2[i]); 9 | } 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/4/ft_strcpy/ft_strcpy.c: -------------------------------------------------------------------------------- 1 | char *ft_strcpy(char *s1, char *s2) 2 | { 3 | int i; 4 | 5 | i = 0; 6 | while (s2[i]) 7 | { 8 | s1[i] = s2[i]; 9 | i++; 10 | } 11 | s1[i] = s2[i]; 12 | return (s1); 13 | } 14 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/6/ft_strcmp/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int ft_strcmp(char *s1, char *s2); 4 | 5 | int main(int ac, char **av) 6 | { 7 | (void)ac; 8 | printf("%d", ft_strcmp(av[1], av[2])); 9 | return (0); 10 | } 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/ft_strcmp/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int ft_strcmp(char *s1, char *s2); 4 | 5 | int main(int ac, char **av) 6 | { 7 | (void)ac; 8 | printf("%d", ft_strcmp(av[1], av[2])); 9 | return (0); 10 | } 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/cpp_module01/Dummy.cpp: -------------------------------------------------------------------------------- 1 | #include "Dummy.hpp" 2 | 3 | Dummy::Dummy(): ATarget("Target Practice Dummy") {} 4 | Dummy::~Dummy() {} 5 | 6 | ATarget *Dummy::clone() const 7 | { 8 | return (new Dummy()); 9 | } 10 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/Dummy.cpp: -------------------------------------------------------------------------------- 1 | #include "Dummy.hpp" 2 | 3 | Dummy::Dummy(): ATarget("Target Practice Dummy") {} 4 | Dummy::~Dummy() {} 5 | 6 | ATarget *Dummy::clone() const 7 | { 8 | return (new Dummy()); 9 | } 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/6/ft_strrev/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *ft_strrev(char *str); 4 | 5 | int main(int ac, char **argv) 6 | { 7 | char *s = argv[1]; 8 | ft_strrev(s); 9 | printf("%s\n", s); 10 | return (0); 11 | } 12 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/ft_strrev/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *ft_strrev(char *str); 4 | 5 | int main(int ac, char **argv) 6 | { 7 | char *s = argv[1]; 8 | ft_strrev(s); 9 | printf("%s\n", s); 10 | return (0); 11 | } 12 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/cpp_module01/Fwoosh.cpp: -------------------------------------------------------------------------------- 1 | #include "Fwoosh.hpp" 2 | 3 | Fwoosh::Fwoosh(): ASpell("Fwoosh", "fwooshed") {} 4 | Fwoosh::~Fwoosh() {} 5 | 6 | ASpell *Fwoosh::clone() const 7 | { 8 | return (new Fwoosh()); 9 | } 10 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/Fwoosh.cpp: -------------------------------------------------------------------------------- 1 | #include "Fwoosh.hpp" 2 | 3 | Fwoosh::Fwoosh(): ASpell("Fwoosh", "fwooshed") {} 4 | Fwoosh::~Fwoosh() {} 5 | 6 | ASpell *Fwoosh::clone() const 7 | { 8 | return (new Fwoosh()); 9 | } 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/2/aff_first_param/aff_first_param.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | if (ac > 1) 6 | while (*av[1]) 7 | write(1, av[1]++, 1); 8 | write(1, "\n", 1); 9 | return (0); 10 | } 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/7/wdmatch/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void wdmatch(char *s1, char *s2); 4 | 5 | int main(int ac, char **av) 6 | { 7 | if (ac == 3) 8 | wdmatch(av[1], av[2]); 9 | write(1, "\n", 1); 10 | return (0); 11 | } 12 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/wdmatch/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void wdmatch(char *s1, char *s2); 4 | 5 | int main(int ac, char **av) 6 | { 7 | if (ac == 3) 8 | wdmatch(av[1], av[2]); 9 | write(1, "\n", 1); 10 | return (0); 11 | } 12 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/cpp_module01/Dummy.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ATarget.hpp" 4 | 5 | class Dummy: public ATarget 6 | { 7 | public: 8 | Dummy(); 9 | ~Dummy(); 10 | 11 | virtual ATarget *clone() const; 12 | }; -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/cpp_module01/Fwoosh.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ASpell.hpp" 4 | 5 | class Fwoosh: public ASpell 6 | { 7 | public: 8 | Fwoosh(); 9 | ~Fwoosh(); 10 | 11 | virtual ASpell *clone() const; 12 | }; -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/Dummy.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ATarget.hpp" 4 | 5 | class Dummy: public ATarget 6 | { 7 | public: 8 | Dummy(); 9 | ~Dummy(); 10 | 11 | virtual ATarget *clone() const; 12 | }; -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/Fireball.cpp: -------------------------------------------------------------------------------- 1 | #include "Fireball.hpp" 2 | 3 | Fireball::Fireball(): ASpell("Fireball", "burnt to a crisp") {} 4 | Fireball::~Fireball() {} 5 | 6 | ASpell *Fireball::clone() const 7 | { 8 | return (new Fireball()); 9 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/Fwoosh.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ASpell.hpp" 4 | 5 | class Fwoosh: public ASpell 6 | { 7 | public: 8 | Fwoosh(); 9 | ~Fwoosh(); 10 | 11 | virtual ASpell *clone() const; 12 | }; -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/2/aff_last_param/aff_last_param.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int main(int ac, char **av) 5 | { 6 | if (ac > 1) 7 | while (*av[ac - 1]) 8 | write(1, av[ac - 1]++, 1); 9 | write(1, "\n", 1); 10 | return (0); 11 | } 12 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/7/is_power_of_2/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int is_power_of_2(unsigned int n); 5 | 6 | int main(int argc, char **argv) 7 | { 8 | printf("%d", is_power_of_2(atoi(argv[1]))); 9 | return(0); 10 | } 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/is_power_of_2/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int is_power_of_2(unsigned int n); 5 | 6 | int main(int argc, char **argv) 7 | { 8 | printf("%d", is_power_of_2(atoi(argv[1]))); 9 | return(0); 10 | } 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_atoi/main.c: -------------------------------------------------------------------------------- 1 | 2 | int ft_atoi(const char *str); 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | printf("ft_atoi(\"%s\") = %d\n", argv[1], ft_atoi(argv[1])); 9 | return(0); 10 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/BrickWall.cpp: -------------------------------------------------------------------------------- 1 | #include "BrickWall.hpp" 2 | 3 | BrickWall::BrickWall(): ATarget("Inconspicuous Red-brick Wall") {} 4 | BrickWall::~BrickWall() {} 5 | 6 | ATarget *BrickWall::clone() const 7 | { 8 | return (new BrickWall()); 9 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/Fireball.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ASpell.hpp" 4 | 5 | class Fireball: public ASpell 6 | { 7 | public: 8 | Fireball(); 9 | ~Fireball(); 10 | 11 | virtual ASpell *clone() const; 12 | }; -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/0/ft_countdown/ft_countdown.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | char c; 6 | 7 | c = '9'; 8 | while (c >= '0') 9 | { 10 | write(1, &c, 1); 11 | c--; 12 | } 13 | write(1, "\n", 1); 14 | return (0); 15 | } 16 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/hidenp/examples.txt: -------------------------------------------------------------------------------- 1 | $>./hidenp "fgex.;" "tyf34gdgf;'ektufjhgdgex.;.;rtjynur6" | cat -e 2 | 1$ 3 | $>./hidenp "abc" "2altrb53c.sse" | cat -e 4 | 1$ 5 | $>./hidenp "abc" "btarc" | cat -e 6 | 0$ 7 | $>./hidenp | cat -e 8 | $ 9 | $> 10 | 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/hidenp/examples.txt: -------------------------------------------------------------------------------- 1 | $>./hidenp "fgex.;" "tyf34gdgf;'ektufjhgdgex.;.;rtjynur6" | cat -e 2 | 1$ 3 | $>./hidenp "abc" "2altrb53c.sse" | cat -e 4 | 1$ 5 | $>./hidenp "abc" "btarc" | cat -e 6 | 0$ 7 | $>./hidenp | cat -e 8 | $ 9 | $> 10 | 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/BrickWall.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ATarget.hpp" 4 | 5 | class BrickWall: public ATarget 6 | { 7 | public: 8 | BrickWall(); 9 | ~BrickWall(); 10 | 11 | virtual ATarget *clone() const; 12 | }; -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/Polymorph.cpp: -------------------------------------------------------------------------------- 1 | #include "Polymorph.hpp" 2 | 3 | Polymorph::Polymorph(): ASpell("Polymorph", "turned into a critter") {} 4 | Polymorph::~Polymorph() {} 5 | 6 | ASpell *Polymorph::clone() const 7 | { 8 | return (new Polymorph()); 9 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/Polymorph.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ASpell.hpp" 4 | 5 | class Polymorph: public ASpell 6 | { 7 | public: 8 | Polymorph(); 9 | ~Polymorph(); 10 | 11 | virtual ASpell *clone() const; 12 | }; -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/7/print_bits/main.c: -------------------------------------------------------------------------------- 1 | # include 2 | #include 3 | 4 | void print_bits(unsigned char octet); 5 | 6 | int main(int argc, char **argv) 7 | { 8 | int n = atoi(argv[1]); 9 | print_bits(n); 10 | write(1, "\n", 1); 11 | } 12 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/print_bits/main.c: -------------------------------------------------------------------------------- 1 | # include 2 | #include 3 | 4 | void print_bits(unsigned char octet); 5 | 6 | int main(int argc, char **argv) 7 | { 8 | int n = atoi(argv[1]); 9 | print_bits(n); 10 | write(1, "\n", 1); 11 | } 12 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_06/0/mini_serv/test_eof.sh: -------------------------------------------------------------------------------- 1 | if [ $(uname) == "Darwin" ]; then 2 | nc_command="nc localhost $1" 3 | else 4 | nc_command="nc -q 0 localhost $1" 5 | fi 6 | 7 | for x in `cat eof_test`; do 8 | printf $x 9 | sleep 0.1 10 | done | eval $nc_command 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/0/ft_print_numbers/ft_print_numbers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_print_numbers(void) 4 | { 5 | char nb; 6 | 7 | nb = '0'; 8 | while (nb <= '9') 9 | { 10 | write(1, &nb, 1); 11 | nb++; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_strcpy/ft_strcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *ft_strcpy(char *s1, char *s2) 4 | { 5 | int i; 6 | 7 | i = 0; 8 | while (s2[i] != '\0') 9 | { 10 | s1[i] = s2[i]; 11 | i++; 12 | } 13 | s1[i] = '\0'; 14 | return (s1); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/max/max.c: -------------------------------------------------------------------------------- 1 | int max(int* tab, unsigned int len) 2 | { 3 | if (len == 0) 4 | return (0); 5 | int res = tab[0]; 6 | for (unsigned int i = 0; i < len; i += 1) 7 | { 8 | if (res < tab[i]) 9 | res = tab[i]; 10 | } 11 | return (res); 12 | } 13 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strcmp/ft_strcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int ft_strcmp(char *s1, char *s2) 5 | { 6 | int i; 7 | 8 | i = 0; 9 | while (s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0') 10 | i++; 11 | return (s1[i] - s2[i]); 12 | } 13 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/fizzbuzz/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='fizzbuzz.c' 2 | ASSIGN='fizzbuzz' 3 | 4 | bash .system/auto_correc_program.sh $FILE $ASSIGN 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | touch .system/grading/passed; 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_swap/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='ft_swap.c' 2 | ASSIGN='ft_swap' 3 | 4 | bash .system/auto_correc_main.sh $FILE $ASSIGN 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | 11 | touch .system/grading/passed; 12 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/4/ft_strcpy/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *ft_strcpy(char *s1, char *s2); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | (void)argc; 8 | printf("%s\n", argv[1]); 9 | ft_strcpy(argv[1], argv[2]); 10 | printf("%s\n", argv[2]); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/is_power_of_2/is_power_of_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int is_power_of_2(unsigned int n) 4 | { 5 | if (n == 0) 6 | return (0); 7 | while (n > 1) 8 | { 9 | if (n % 2 == 0) 10 | n = n / 2; 11 | else 12 | return (0); 13 | } 14 | return (1); 15 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/lcm/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | unsigned int lcm(unsigned int a, unsigned int b); 5 | 6 | int main(int argc, char **argv) 7 | { 8 | unsigned int a = atoi(argv[1]); 9 | unsigned int b = atoi(argv[2]); 10 | printf("%d\n", lcm(a,b)); 11 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/0/ft_strcpy/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *ft_strcpy(char *s1, char *s2); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | (void)argc; 8 | printf("%s\n", argv[1]); 9 | ft_strcpy(argv[1], argv[2]); 10 | printf("%s\n", argv[2]); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/3/only_a/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : only_a 2 | Expected files : only_a.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays a 'a' character on the standard output. 7 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/3/only_z/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : only_z 2 | Expected files : only_z.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays a 'z' character on the standard output. 7 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_list_size/tester.sh: -------------------------------------------------------------------------------- 1 | 2 | FILE='ft_list_size.c' 3 | ASSIGN='ft_list_size' 4 | 5 | bash .system/auto_correc_main.sh $FILE $ASSIGN 6 | if [ -e .system/grading/traceback ];then 7 | mv .system/grading/traceback . 8 | exit 1 9 | fi 10 | 11 | touch .system/grading/passed; 12 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/print_bits/print_bits.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void print_bits(unsigned char octet) 4 | { 5 | int i; 6 | 7 | for (i = 7; i >= 0; i--) 8 | { 9 | if (octet & (1 << i)) 10 | write (1, "1", 1); 11 | else 12 | write (1, "0", 1); 13 | } 14 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strcspn/main.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | size_t ft_strcspn(const char *s, const char *reject); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | if (argc == 3) 8 | printf("ft_strcspn(\"%s\", \"%s\") = %zu\n", argv[1], argv[2], ft_strcspn(argv[1], argv[2])); 9 | return(0); 10 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_atoi_base/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int ft_atoi_base(const char *str, int str_base); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | if (argc == 3) 8 | { 9 | printf("%d\n", ft_atoi_base(argv[1], atoi(argv[2]))); 10 | } 11 | return (0); 12 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strcmp/main.c: -------------------------------------------------------------------------------- 1 | 2 | int ft_strcmp(char *s1, char *s2); 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | if (argc == 3) 9 | printf("ft_strcmp(\"%s\", \"%s\") = %d\n", argv[1], argv[2], ft_strcmp(argv[1], argv[2])); 10 | return(0); 11 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/rev_print/rev_print.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | int i; 6 | 7 | i = 0; 8 | if (ac == 2) 9 | { 10 | while(av[1][i] != '\0') 11 | i++; 12 | while (i >= 1) 13 | { 14 | write(1, &av[1][i - 1], 1); 15 | i--; 16 | } 17 | } 18 | write(1, "\n", 1); 19 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/is_power_of_2/main.c: -------------------------------------------------------------------------------- 1 | 2 | int is_power_of_2(unsigned int n); 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | if(argc == 1) 9 | return(0); 10 | printf("is_power_of_2(\"%s\") = %d\n", argv[1], is_power_of_2(atoi(argv[1]))); 11 | return(0); 12 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/3/maff_revalpha/maff_revalpha.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_putchar(char c) 4 | { 5 | write(1, &c, 1); 6 | } 7 | 8 | int main(void) 9 | { 10 | int i; 11 | 12 | i = 123; 13 | while (i-- > 97) 14 | (i % 2 == 0) ? ft_putchar(i) : ft_putchar(i - 32); 15 | ft_putchar('\n');; 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # EXEC: source <(curl https://raw.githubusercontent.com/Seraph919/Grademe-edu/main/install.sh) 5 | # 6 | 7 | REPO_URL="https://github.com/Seraph919/Grademe-edu.git" 8 | REPO_DIR="Grademe-edu" 9 | 10 | if [ ! -d "$REPO_DIR" ]; then 11 | git clone "$REPO_URL" 12 | fi 13 | 14 | make -C "$REPO_DIR" && make 15 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_strcpy/main.c: -------------------------------------------------------------------------------- 1 | 2 | char *ft_strcpy(char *s1, char *s2); 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | char *str = malloc(sizeof(char) * 100); 9 | printf("ft_strcpy(\"%s\", str) = %s\n", argv[1], ft_strcpy(str, argv[1])); 10 | free(str); 11 | return(0); 12 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/6/ft_swap/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_swap(int *a, int *b); 4 | 5 | int main (int argc, char **argv) 6 | { 7 | (void)argc; 8 | int *a; 9 | int *b; 10 | 11 | *a = atoi(argv[1]); 12 | *b = atoi(argv[2]); 13 | printf("%d\n%d", a, b); 14 | ft_swap(&a, &b); 15 | printf("%d\n%d", a, b); 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/2/ft_swap/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_swap(int *a, int *b); 4 | 5 | int main (int argc, char **argv) 6 | { 7 | (void)argc; 8 | int *a; 9 | int *b; 10 | 11 | *a = atoi(argv[1]); 12 | *b = atoi(argv[2]); 13 | printf("%d\n%d", a, b); 14 | ft_swap(&a, &b); 15 | printf("%d\n%d", a, b); 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/5/swap_bits/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned char swap_bits(unsigned char octet); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | unsigned char c; 8 | 9 | c = argv[1][0]; 10 | write(1, &c, 1); 11 | write(1, "\n", 1); 12 | c = swap_bits(c); 13 | write(1, &c, 1); 14 | write(1, "\n", 1); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/swap_bits/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned char swap_bits(unsigned char octet); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | unsigned char c; 8 | 9 | c = argv[1][0]; 10 | write(1, &c, 1); 11 | write(1, "\n", 1); 12 | c = swap_bits(c); 13 | write(1, &c, 1); 14 | write(1, "\n", 1); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/print_bits/main.c: -------------------------------------------------------------------------------- 1 | void print_bits(unsigned char octet); 2 | #include 3 | #include 4 | 5 | int main (int argc, char **argv) 6 | { 7 | unsigned char octet; 8 | 9 | if (argc == 2) 10 | 11 | octet = atoi(argv[1]); 12 | print_bits(octet); 13 | printf("\n"); 14 | 15 | return 0; 16 | 17 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/swap_bits/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned char swap_bits(unsigned char octet); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | unsigned char c; 8 | 9 | c = argv[1][0]; 10 | write(1, &c, 1); 11 | write(1, "\n", 1); 12 | c = swap_bits(c); 13 | write(1, &c, 1); 14 | write(1, "\n", 1); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/5/reverse_bits/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned char reverse_bits(unsigned char b); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | unsigned char c; 8 | 9 | c = argv[1][0]; 10 | write(1, &c, 1); 11 | write(1, "\n", 1); 12 | c = reverse_bits(c); 13 | write(1, &c, 1); 14 | write(1, "\n", 1); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/reverse_bits/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned char reverse_bits(unsigned char b); 4 | 5 | int main(int argc, char **argv) 6 | { 7 | unsigned char c; 8 | 9 | c = argv[1][0]; 10 | write(1, &c, 1); 11 | write(1, "\n", 1); 12 | c = reverse_bits(c); 13 | write(1, &c, 1); 14 | write(1, "\n", 1); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/6/ft_strrev/ft_strrev.c: -------------------------------------------------------------------------------- 1 | char *ft_strrev(char *str) 2 | { 3 | int len; 4 | int i; 5 | char tmp; 6 | 7 | len = 0; 8 | i = 0; 9 | while (str[len]) 10 | len++; 11 | len -= 1; 12 | while (i < len) 13 | { 14 | tmp = str[i]; 15 | str[i] = str[len]; 16 | str[len] = tmp; 17 | i++; 18 | len--; 19 | } 20 | return (str); 21 | } 22 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/ft_strrev/ft_strrev.c: -------------------------------------------------------------------------------- 1 | char *ft_strrev(char *str) 2 | { 3 | int len; 4 | int i; 5 | char tmp; 6 | 7 | len = 0; 8 | i = 0; 9 | while (str[len]) 10 | len++; 11 | len -= 1; 12 | while (i < len) 13 | { 14 | tmp = str[i]; 15 | str[i] = str[len]; 16 | str[len] = tmp; 17 | i++; 18 | len--; 19 | } 20 | return (str); 21 | } 22 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/3/lcm/lcm.c: -------------------------------------------------------------------------------- 1 | unsigned int lcm(unsigned int a, unsigned int b) 2 | { 3 | unsigned int d; 4 | 5 | if (!a || !b) 6 | return (0); 7 | if (a > b) 8 | d = (a / 2) + 1; 9 | else 10 | d = (b / 2) + 1; 11 | while (!((a % d) == 0 && (b % d) == 0)) 12 | d--; 13 | return (a * b / d); 14 | } 15 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/1/lcm/lcm.c: -------------------------------------------------------------------------------- 1 | unsigned int lcm(unsigned int a, unsigned int b) 2 | { 3 | unsigned int d; 4 | 5 | if (!a || !b) 6 | return (0); 7 | if (a > b) 8 | d = (a / 2) + 1; 9 | else 10 | d = (b / 2) + 1; 11 | while (!((a % d) == 0 && (b % d) == 0)) 12 | d--; 13 | return (a * b / d); 14 | } 15 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/lcm/lcm.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | unsigned int lcm(unsigned int a, unsigned int b) 4 | { 5 | if (a == 0 || b == 0) 6 | return (0); 7 | 8 | unsigned int n; 9 | if (a > b) 10 | n = a; 11 | else 12 | n = b; 13 | 14 | while (1) 15 | { 16 | if (n % a == 0 && n % b == 0) 17 | return (n); 18 | ++n; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/0/aff_a/aff_a.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char **argv) 4 | { 5 | if (argc != 2) 6 | write(1, "a", 1); 7 | else 8 | { 9 | while (*argv[1]) 10 | { 11 | if (*argv[1] == 'a') 12 | { 13 | write(1, "a", 1); 14 | break; 15 | } 16 | argv[1]++; 17 | } 18 | } 19 | write(1, "\n", 1); 20 | return (0); 21 | } 22 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_list_size/ft_list_size.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | typedef struct s_list 4 | { 5 | struct s_list *next; 6 | void *data; 7 | } t_list; 8 | 9 | int ft_list_size(t_list *begin_list) 10 | { 11 | if (begin_list == 0) 12 | return (0); 13 | else 14 | return (1 + ft_list_size(begin_list->next)); 15 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_strlen/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strlen 2 | Expected files : ft_strlen.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that returns the length of a string. 7 | 8 | Your function must be declared as follows: 9 | 10 | int ft_strlen(char *str); 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/4/ft_strlen/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strlen 2 | Expected files : ft_strlen.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that returns the length of a string. 7 | 8 | Your function must be declared as follows: 9 | 10 | int ft_strlen(char *str); 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/0/ft_strlen/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strlen 2 | Expected files : ft_strlen.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that returns the length of a string. 7 | 8 | Your function must be declared as follows: 9 | 10 | int ft_strlen(char *str); 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_strlen/main.c: -------------------------------------------------------------------------------- 1 | 2 | int ft_strlen(char *str); 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | if(argc == 1) 9 | { 10 | printf("ft_strlen(\"\") = %d\n", ft_strlen("")); 11 | return(0); 12 | } 13 | printf("ft_strlen(\"%s\") = %d\n", argv[1], ft_strlen(argv[1])); 14 | return(0); 15 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_putstr/main.c: -------------------------------------------------------------------------------- 1 | 2 | void ft_putstr(char *str); 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | if(argc == 1) 9 | { 10 | printf("ft_putstr(\"\")\n"); 11 | return(0); 12 | } 13 | printf("ft_putstr(\"%s\")\n", argv[1]); 14 | ft_putstr(argv[1]); 15 | printf("\n"); 16 | return(0); 17 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strdup/main.c: -------------------------------------------------------------------------------- 1 | 2 | char *ft_strdup(char *src); 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | if(argc == 1) 9 | { 10 | printf("ft_strdup(\"\") = %s\n", ft_strdup("")); 11 | return(0); 12 | } 13 | printf("ft_strdup(\"%s\") = %s\n", argv[1], ft_strdup(argv[1])); 14 | return(0); 15 | } -------------------------------------------------------------------------------- /.system/qrcode: -------------------------------------------------------------------------------- 1 | █████████████████████████ 2 | ██ ▄▄▄▄▄ █ ▄ █ █ ▄▄▄▄▄ ██ 3 | ██ █ █ █ ▀▀ █ █ █ ██ 4 | ██ █▄▄▄█ █▀▀██ █ █▄▄▄█ ██ 5 | ██▄▄▄▄▄▄▄█▄▀ ▀ █▄▄▄▄▄▄▄██ 6 | ██ ▄▀▀▄ ▄▀█ ▀▀▄█▀▄▀▄▄ ▄██ 7 | ████ ██ ▄▄▄ ▄▀▀▀██ ██ ▀██ 8 | ██▄▄█▄█▄▄▄ █▄▄▄▄▀█▀ ▀▀▄██ 9 | ██ ▄▄▄▄▄ █▀▄▄▀▀ █▀▄ █ ▀██ 10 | ██ █ █ █▄ ▄█▄█▀▀▀█▀▀██ 11 | ██ █▄▄▄█ █▀██▄█ ██▄▄▄████ 12 | ██▄▄▄▄▄▄▄█▄▄▄▄▄▄█▄████▄██ 13 | █████████████████████████ 14 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/4/ft_strdup/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strdup 2 | Expected files : ft_strdup.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Reproduce the behavior of the function strdup (man strdup). 7 | 8 | Your function must be declared as follows: 9 | 10 | char *ft_strdup(char *src); 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/ft_strdup/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strdup 2 | Expected files : ft_strdup.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Reproduce the behavior of the function strdup (man strdup). 7 | 8 | Your function must be declared as follows: 9 | 10 | char *ft_strdup(char *src); 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_strcpy/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strcpy 2 | Expected files : ft_strcpy.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Reproduce the behavior of the function strcpy (man strcpy). 7 | 8 | Your function must be declared as follows: 9 | 10 | char *ft_strcpy(char *s1, char *s2); 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strcmp/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strcmp 2 | Expected files : ft_strcmp.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Reproduce the behavior of the function strcmp (man strcmp). 7 | 8 | Your function must be declared as follows: 9 | 10 | int ft_strcmp(char *s1, char *s2); 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strdup/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strdup 2 | Expected files : ft_strdup.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Reproduce the behavior of the function strdup (man strdup). 7 | 8 | Your function must be declared as follows: 9 | 10 | char *ft_strdup(char *src); 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/1/hello/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : hello 2 | Expected files : hello.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays "Hello World!" followed by a \n. 7 | 8 | Example: 9 | 10 | $>./hello 11 | Hello World! 12 | $>./hello | cat -e 13 | Hello World!$ 14 | $> 15 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/4/ft_strcpy/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strcpy 2 | Expected files : ft_strcpy.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Reproduce the behavior of the function strcpy (man strcpy). 7 | 8 | Your function must be declared as follows: 9 | 10 | char *ft_strcpy(char *s1, char *s2); 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/0/ft_strcpy/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strcpy 2 | Expected files : ft_strcpy.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Reproduce the behavior of the function strcpy (man strcpy). 7 | 8 | Your function must be declared as follows: 9 | 10 | char *ft_strcpy(char *s1, char *s2); 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/6/ft_strcmp/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strcmp 2 | Expected files : ft_strcmp.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Reproduce the behavior of the function strcmp (man strcmp). 7 | 8 | Your function must be declared as follows: 9 | 10 | int ft_strcmp(char *s1, char *s2); 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/ft_strcmp/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strcmp 2 | Expected files : ft_strcmp.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Reproduce the behavior of the function strcmp (man strcmp). 7 | 8 | Your function must be declared as follows: 9 | 10 | int ft_strcmp(char *s1, char *s2); 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strcspn/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strcspn 2 | Expected files : ft_strcspn.c 3 | Allowed functions: None 4 | --------------------------------------------------------------- 5 | 6 | Reproduce exactly the behavior of the function strcspn 7 | (man strcspn). 8 | 9 | The function should be prototyped as follows: 10 | 11 | size_t ft_strcspn(const char *s, const char *reject); -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/0/ft_countdown/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_countdown 2 | Expected files : ft_countdown.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays all digits in descending order, followed by a 7 | newline. 8 | 9 | Example: 10 | $> ./ft_countdown | cat -e 11 | 9876543210$ 12 | $> 13 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/0/ft_print_numbers/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_print_numbers 2 | Expected files : ft_print_numbers.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that displays all digits in ascending order. 7 | 8 | Your function must be declared as follows: 9 | 10 | void ft_print_numbers(void); 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/epur_str/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | $> ./epur_str "vous voyez c'est facile d'afficher la meme chose" | cat -e 2 | vous voyez c'est facile d'afficher la meme chose$ 3 | $> ./epur_str " seulement la c'est plus dur " | cat -e 4 | seulement la c'est plus dur$ 5 | $> ./epur_str "comme c'est cocasse" "vous avez entendu, Mathilde ?" | cat -e 6 | $ 7 | $> ./epur_str "" | cat -e 8 | $ 9 | $> 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/epur_str/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | $> ./epur_str "vous voyez c'est facile d'afficher la meme chose" | cat -e 2 | vous voyez c'est facile d'afficher la meme chose$ 3 | $> ./epur_str " seulement la c'est plus dur " | cat -e 4 | seulement la c'est plus dur$ 5 | $> ./epur_str "comme c'est cocasse" "vous avez entendu, Mathilde ?" | cat -e 6 | $ 7 | $> ./epur_str "" | cat -e 8 | $ 9 | $> 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/4/ft_strdup/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *ft_strdup(char *src); 5 | 6 | void test(char *str) 7 | { 8 | printf("%s = ", str); 9 | printf("%s | ", ft_strdup(str)); 10 | } 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | int i; 15 | 16 | i = 1; 17 | if (argc == 1) 18 | return (0); 19 | while (argv[i]) 20 | test(argv[i++]); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/ft_strdup/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *ft_strdup(char *src); 5 | 6 | void test(char *str) 7 | { 8 | printf("%s = ", str); 9 | printf("%s | ", ft_strdup(str)); 10 | } 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | int i; 15 | 16 | i = 1; 17 | if (argc == 1) 18 | return (0); 19 | while (argv[i]) 20 | test(argv[i++]); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/6/ft_strrev/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strrev 2 | Expected files : ft_strrev.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that reverses (in-place) a string. 7 | 8 | It must return its parameter. 9 | 10 | Your function must be declared as follows: 11 | 12 | char *ft_strrev(char *str); 13 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/7/max/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int max(int *tab, unsigned int len); 5 | 6 | int main(int argc, char **argv) 7 | { 8 | int *tab; 9 | int i = 0; 10 | 11 | if (!(tab = (int*)malloc(sizeof(int) * 3))) 12 | return (0); 13 | while (i < argc-1) 14 | { 15 | tab[i] = atoi(argv[i+1]); 16 | i++; 17 | } 18 | printf("%d", max(tab, argc-1)); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/ft_strrev/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_strrev 2 | Expected files : ft_strrev.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that reverses (in-place) a string. 7 | 8 | It must return its parameter. 9 | 10 | Your function must be declared as follows: 11 | 12 | char *ft_strrev(char *str); 13 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/max/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int max(int *tab, unsigned int len); 5 | 6 | int main(int argc, char **argv) 7 | { 8 | int *tab; 9 | int i = 0; 10 | 11 | if (!(tab = (int*)malloc(sizeof(int) * 3))) 12 | return (0); 13 | while (i < argc-1) 14 | { 15 | tab[i] = atoi(argv[i+1]); 16 | i++; 17 | } 18 | printf("%d", max(tab, argc-1)); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/paramsum/paramsum.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | #include 4 | 5 | void ft_putnbr(int n) 6 | { 7 | char digit; 8 | 9 | if (n >= 10) 10 | ft_putnbr(n / 10); 11 | 12 | digit = (n % 10) + '0'; 13 | write(1, &digit, 1); 14 | } 15 | 16 | int main(int argc, char **argv) 17 | { 18 | (void)argv; 19 | 20 | ft_putnbr(argc - 1); 21 | write(1, "\n", 1); 22 | 23 | return (0); 24 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/3/tab_mult/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | $>./tab_mult 9 2 | 1 x 9 = 9 3 | 2 x 9 = 18 4 | 3 x 9 = 27 5 | 4 x 9 = 36 6 | 5 x 9 = 45 7 | 6 x 9 = 54 8 | 7 x 9 = 63 9 | 8 x 9 = 72 10 | 9 x 9 = 81 11 | $>./tab_mult 19 12 | 1 x 19 = 19 13 | 2 x 19 = 38 14 | 3 x 19 = 57 15 | 4 x 19 = 76 16 | 5 x 19 = 95 17 | 6 x 19 = 114 18 | 7 x 19 = 133 19 | 8 x 19 = 152 20 | 9 x 19 = 171 21 | $> 22 | $>./tab_mult | cat -e 23 | $ 24 | $> 25 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/1/tab_mult/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | $>./tab_mult 9 2 | 1 x 9 = 9 3 | 2 x 9 = 18 4 | 3 x 9 = 27 5 | 4 x 9 = 36 6 | 5 x 9 = 45 7 | 6 x 9 = 54 8 | 7 x 9 = 63 9 | 8 x 9 = 72 10 | 9 x 9 = 81 11 | $>./tab_mult 19 12 | 1 x 19 = 19 13 | 2 x 19 = 38 14 | 3 x 19 = 57 15 | 4 x 19 = 76 16 | 5 x 19 = 95 17 | 6 x 19 = 114 18 | 7 x 19 = 133 19 | 8 x 19 = 152 20 | 9 x 19 = 171 21 | $> 22 | $>./tab_mult | cat -e 23 | $ 24 | $> 25 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_swap/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_swap 2 | Expected files : ft_swap.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that swaps the contents of two integers the adresses of which 7 | are passed as parameters. 8 | 9 | Your function must be declared as follows: 10 | 11 | void ft_swap(int *a, int *b); 12 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/6/ft_swap/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_swap 2 | Expected files : ft_swap.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that swaps the contents of two integers the adresses of which 7 | are passed as parameters. 8 | 9 | Your function must be declared as follows: 10 | 11 | void ft_swap(int *a, int *b); 12 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/2/ft_swap/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_swap 2 | Expected files : ft_swap.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that swaps the contents of two integers the adresses of which 7 | are passed as parameters. 8 | 9 | Your function must be declared as follows: 10 | 11 | void ft_swap(int *a, int *b); 12 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_atoi/ft_atoi.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int ft_atoi(const char *str) 4 | { 5 | int nbr; 6 | int sig; 7 | int i; 8 | 9 | nbr = 0; 10 | sig = 1; 11 | i = 0; 12 | if (str[0] == '-' || str[0] == '+') 13 | { 14 | if (str[0] == '-') 15 | sig = -1; 16 | i += 1; 17 | } 18 | while (str[i] && str[i] >= '0' && str[i] <= '9') 19 | nbr = (nbr * 10) + (str[i++] - '0'); 20 | return (nbr * sig); 21 | } 22 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_03/0/get_next_line/mainboc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char *get_next_line(int fd); 6 | 7 | int main(void) 8 | { 9 | char *line; 10 | 11 | while ((line = get_next_line(0)) != NULL) 12 | { 13 | printf("%s", line); 14 | free(line); 15 | line = NULL; 16 | } 17 | printf("%s", line); 18 | free(line); 19 | system("leaks boc > bocleak 2>&1"); 20 | return(0); 21 | } 22 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_03/0/get_next_line/mainstud.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char *get_next_line(int fd); 6 | 7 | int main(void) 8 | { 9 | char *line; 10 | 11 | while ((line = get_next_line(0)) != NULL) 12 | { 13 | printf("%s", line); 14 | free(line); 15 | line = NULL; 16 | } 17 | printf("%s", line); 18 | free(line); 19 | system("leaks stud > studleak 2>&1"); 20 | return(0); 21 | } 22 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ulstr/ulstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | int i; 6 | 7 | i = 0; 8 | if (ac == 2) 9 | { 10 | while(av[1][i] != '\0') 11 | { 12 | if(av[1][i] >= 'a' && av[1][i]<= 'z') 13 | av[1][i] = av[1][i] - 32; 14 | else if(av[1][i] >= 'A' && av[1][i]<= 'Z') 15 | av[1][i] = av[1][i] + 32; 16 | write(1, &av[1][i], 1); 17 | i++; 18 | } 19 | } 20 | write(1, "\n", 1); 21 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/snake_to_camel/snake_to_camel.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char **argv) 5 | { 6 | if (argc == 2) 7 | { 8 | for (int i = 0; argv[1][i]; i += 1) 9 | { 10 | if (argv[1][i] == '_') 11 | { 12 | i += 1; 13 | argv[1][i] -= 32; 14 | } 15 | write(STDOUT_FILENO, &argv[1][i], 1); 16 | } 17 | } 18 | write(STDOUT_FILENO, "\n", 1); 19 | return EXIT_SUCCESS; 20 | } 21 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strcspn/ft_strcspn.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | size_t ft_strcspn(const char *s, const char *reject) 7 | { 8 | size_t i; 9 | size_t k; 10 | 11 | i = 0; 12 | k = 0; 13 | while (s[i] != '\0') 14 | { 15 | while (reject[k] != '\0') 16 | { 17 | if (reject[k] == s[i]) 18 | return (i); 19 | k++; 20 | } 21 | k = 0; 22 | i++; 23 | } 24 | return (i); 25 | } 26 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_range/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int *ft_range(int start, int end); 5 | 6 | int main(int argc, char **argv) 7 | { 8 | (void)argc; 9 | int arr_len; 10 | int *arr; 11 | 12 | arr_len = abs(atoi(argv[2]) - atoi(argv[1])); 13 | arr = ft_range(atoi(argv[1]), atoi(argv[2])); 14 | for (int i = 0; i <= arr_len; i += 1) 15 | printf("%d\n", arr[i]); 16 | free(arr); 17 | return (EXIT_SUCCESS); 18 | } 19 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/1/maff_alpha/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : maff_alpha 2 | Expected files : maff_alpha.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays the alphabet, with even letters in uppercase, and 7 | odd letters in lowercase, followed by a newline. 8 | 9 | Example: 10 | 11 | $> ./maff_alpha | cat -e 12 | aBcDeFgHiJkLmNoPqRsTuVwXyZ$ 13 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/3/expand_str/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | $> ./expand_str "vous voyez c'est facile d'afficher la meme chose" | cat -e 2 | vous voyez c'est facile d'afficher la meme chose$ 3 | $> ./expand_str " seulement la c'est plus dur " | cat -e 4 | seulement la c'est plus dur$ 5 | $> ./expand_str "comme c'est cocasse" "vous avez entendu, Mathilde ?" | cat -e 6 | $ 7 | $> ./expand_str "" | cat -e 8 | $ 9 | $> 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/1/expand_str/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | $> ./expand_str "vous voyez c'est facile d'afficher la meme chose" | cat -e 2 | vous voyez c'est facile d'afficher la meme chose$ 3 | $> ./expand_str " seulement la c'est plus dur " | cat -e 4 | seulement la c'est plus dur$ 5 | $> ./expand_str "comme c'est cocasse" "vous avez entendu, Mathilde ?" | cat -e 6 | $ 7 | $> ./expand_str "" | cat -e 8 | $ 9 | $> 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/1/str_capitalizer/examples.txt: -------------------------------------------------------------------------------- 1 | $> ./str_capitalizer | cat -e 2 | $ 3 | $> ./str_capitalizer "Premier PETIT TesT" | cat -e 4 | Premier Petit Test$ 5 | $> ./str_capitalizer "DeuxiEmE tEST uN PEU moinS facile" " attention C'EST pas dur QUAND mEmE" "ALLer UN DeRNier 0123456789pour LA rouTE E " | cat -e 6 | Deuxieme Test Un Peu Moins Facile$ 7 | Attention C'est Pas Dur Quand Meme$ 8 | Aller Un Dernier 0123456789pour La Route E $ 9 | $> 10 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/alpha_mirror/alpha_mirror.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | int i; 6 | 7 | i = 0; 8 | if (ac == 2) 9 | { 10 | while (av[1][i] != '\0') 11 | { 12 | if (av[1][i] >= 'a' && av[1][i] <= 'z') 13 | av[1][i] = 219 - av[1][i]; 14 | else if (av[1][i] >= 'A' && av[1][i] <= 'Z') 15 | av[1][i] = 155 - av[1][i]; 16 | write(1, &av[1][i], 1); 17 | i++; 18 | } 19 | } 20 | write(1, "\n", 1); 21 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/pgcd/pgcd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int pgcd(unsigned int nb, unsigned int nb2) 5 | { 6 | int i; 7 | 8 | i = nb; 9 | while (i > 0) 10 | { 11 | if (nb % i == 0 && nb2 % i == 0) 12 | return (i); 13 | i--; 14 | } 15 | return (1); 16 | } 17 | 18 | int main(int argc, char **argv) 19 | { 20 | if (argc == 3) 21 | printf("%d", pgcd(atoi(argv[1]), atoi(argv[2]))); 22 | printf("\n"); 23 | return (0); 24 | } 25 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/pgcd/pgcd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int pgcd(unsigned int nb, unsigned int nb2) 5 | { 6 | int i; 7 | 8 | i = nb; 9 | while (i > 0) 10 | { 11 | if (nb % i == 0 && nb2 % i == 0) 12 | return (i); 13 | i--; 14 | } 15 | return (1); 16 | } 17 | 18 | int main(int argc, char **argv) 19 | { 20 | if (argc == 3) 21 | printf("%d", pgcd(atoi(argv[1]), atoi(argv[2]))); 22 | printf("\n"); 23 | return (0); 24 | } 25 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/3/str_capitalizer/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | $> ./str_capitalizer | cat -e 2 | $ 3 | $> ./str_capitalizer "Premier PETIT TesT" | cat -e 4 | Premier Petit Test$ 5 | $> ./str_capitalizer "DeuxiEmE tEST uN PEU moinS facile" " attention C'EST pas dur QUAND mEmE" "ALLer UN DeRNier 0123456789pour LA rouTE E " | cat -e 6 | Deuxieme Test Un Peu Moins Facile$ 7 | Attention C'est Pas Dur Quand Meme$ 8 | Aller Un Dernier 0123456789pour La Route E $ 9 | $> 10 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/rstr_capitalizer/examples.txt: -------------------------------------------------------------------------------- 1 | $> ./rstr_capitalizer | cat -e 2 | $ 3 | $> ./rstr_capitalizer "Premier PETIT TesT" | cat -e 4 | premieR petiT tesT$ 5 | $> ./rstr_capitalizer "DeuxiEmE tEST uN PEU moinS facile" " attention C'EST pas dur QUAND mEmE" "ALLer UN DeRNier 0123456789pour LA rouTE E " | cat -e 6 | deuxiemE tesT uN peU moinS facilE$ 7 | attentioN c'esT paS duR quanD memE$ 8 | alleR uN dernieR 0123456789pouR lA routE E $ 9 | $> 10 | 11 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/2/ft_itoa/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_itoa 2 | Expected files : ft_itoa.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes an int and converts it to a null-terminated string. 7 | The function returns the result in a char array that you must allocate. 8 | 9 | Your function must be declared as follows: 10 | 11 | char *ft_itoa(int nbr); 12 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_swap/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | void ft_swap(int *a, int *b); 5 | 6 | 7 | int main(void) 8 | { 9 | int *a; 10 | int *b; 11 | int n1; 12 | int n2; 13 | 14 | n1 = 9; 15 | n2 = 6; 16 | a = &n1; 17 | b = &n2; 18 | printf("Value of n1 is: %u and the value of n2 is: %u.", *a, *b); 19 | ft_swap(a, b); 20 | printf("\n"); 21 | printf("Now the value of n1 is: %u and the value of n2 is: %u.", *a, *b); 22 | printf("\n"); 23 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/ft_itoa/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_itoa 2 | Expected files : ft_itoa.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes an int and converts it to a null-terminated string. 7 | The function returns the result in a char array that you must allocate. 8 | 9 | Your function must be declared as follows: 10 | 11 | char *ft_itoa(int nbr); 12 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/rstr_capitalizer/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | $> ./rstr_capitalizer | cat -e 2 | $ 3 | $> ./rstr_capitalizer "Premier PETIT TesT" | cat -e 4 | premieR petiT tesT$ 5 | $> ./rstr_capitalizer "DeuxiEmE tEST uN PEU moinS facile" " attention C'EST pas dur QUAND mEmE" "ALLer UN DeRNier 0123456789pour LA rouTE E " | cat -e 6 | deuxiemE tesT uN peU moinS facilE$ 7 | attentioN c'esT paS duR quanD memE$ 8 | alleR uN dernieR 0123456789pouR lA routE E $ 9 | $> 10 | 11 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/first_word/first_word.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_putchar(char c) 4 | { 5 | write(1, &c, 1); 6 | } 7 | 8 | int main(int ac, char **av) 9 | { 10 | int i; 11 | 12 | i = 0; 13 | if (ac == 2) 14 | { 15 | while (av[1][i] == ' ' || av[1][i] == '\t') 16 | i++; 17 | while (av[1][i] != '\0' && av[1][i] != ' ' && av[1][i] != '\t') 18 | { 19 | ft_putchar(av[1][i]); 20 | i++; 21 | } 22 | } 23 | ft_putchar('\n'); 24 | return (0); 25 | } 26 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/pgcd/pgcd.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | #include 4 | #include 5 | 6 | void pgcd(int a, int b) 7 | { 8 | int n = a; 9 | 10 | while (n > 0) 11 | { 12 | if (a % n == 0 && b % n == 0) 13 | { 14 | printf("%d", n); 15 | return; 16 | } 17 | --n; 18 | } 19 | } 20 | 21 | int main(int argc, char **argv) 22 | { 23 | if (argc == 3) 24 | pgcd(atoi(argv[1]), atoi(argv[2])); 25 | 26 | printf("\n"); 27 | return (0); 28 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/3/maff_revalpha/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : maff_revalpha 2 | Expected files : maff_revalpha.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays the alphabet in reverse, with even letters in 7 | uppercase, and odd letters in lowercase, followed by a newline. 8 | 9 | Example: 10 | 11 | $> ./maff_revalpha | cat -e 12 | zYxWvUtSrQpOnMlKjIhGfEdCbA$ 13 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/rotone/rotone.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | int i; 6 | 7 | i = 0; 8 | if (ac == 2) 9 | { 10 | while (av[1][i]!= '\0') 11 | { 12 | if ((av[1][i] >= 'a' && av[1][i] <= 'y') || (av[1][i] >= 'A' && av[1][i] <= 'Y')) 13 | av[1][i] = av[1][i] + 1; 14 | else if (av[1][i] == 'z' || av[1][i] == 'Z') 15 | av[1][i] = av[1][i] - 25; 16 | write(1, &av[1][i], 1); 17 | i++; 18 | } 19 | } 20 | write(1, "\n",1); 21 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/ft_itoa/attachment/subject.pt.txt: -------------------------------------------------------------------------------- 1 | Nome do exercício: ft_itoa 2 | Arquivos esperados: ft_itoa.c 3 | Funções permitidas: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Escreva uma função que recebe um int e o converte para uma string terminada em nulo. 7 | A função retorna o resultado em um array de char que você deve alocar. 8 | 9 | Sua função deve ser declarada da seguinte forma: 10 | 11 | char *ft_itoa(int nbr); 12 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/ft_split/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char **ft_split(char *str); 5 | 6 | int main(int argc, char **argv) 7 | { 8 | char **split; 9 | int i; 10 | 11 | if (argc == 2) 12 | { 13 | split = ft_split(argv[1]); 14 | printf("%s ", split[0]); 15 | i = 1; 16 | while (split[i] != 0) 17 | { 18 | printf("%s ", split[i]); 19 | i++; 20 | } 21 | printf("%s", split[i]); 22 | } 23 | printf("\n"); 24 | return (0); 25 | } 26 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/6/first_word/first_word.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_putchar(char c) 4 | { 5 | write(1, &c, 1); 6 | } 7 | 8 | int main(int ac, char **av) 9 | { 10 | int i; 11 | 12 | i = 0; 13 | if (ac == 2) 14 | { 15 | while (av[1][i] && (av[1][i] == ' ' || av[1][i] == '\t')) 16 | i++; 17 | while (av[1][i] && (av[1][i] != ' ' && av[1][i] != '\t')) 18 | { 19 | ft_putchar(av[1][i]); 20 | i++; 21 | } 22 | } 23 | ft_putchar('\n'); 24 | return (0); 25 | } 26 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/2/first_word/first_word.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_putchar(char c) 4 | { 5 | write(1, &c, 1); 6 | } 7 | 8 | int main(int ac, char **av) 9 | { 10 | int i; 11 | 12 | i = 0; 13 | if (ac == 2) 14 | { 15 | while (av[1][i] && (av[1][i] == ' ' || av[1][i] == '\t')) 16 | i++; 17 | while (av[1][i] && (av[1][i] != ' ' && av[1][i] != '\t')) 18 | { 19 | ft_putchar(av[1][i]); 20 | i++; 21 | } 22 | } 23 | ft_putchar('\n'); 24 | return (0); 25 | } 26 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/union/union.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char **argv) 4 | { 5 | if (argc == 3) 6 | { 7 | int ascii[255] = {0}; 8 | 9 | for (int i = 0; i < 3; i += 1) 10 | { 11 | int j = 0; 12 | while (argv[i][j]) 13 | { 14 | if (ascii[(int)argv[i][j]] == 0) 15 | { 16 | ascii[(int)argv[i][j]] = 1; 17 | write(1, &argv[i][j], 1); 18 | } 19 | j += 1; 20 | } 21 | } 22 | } 23 | write(1, "\n", 1); 24 | return (0); 25 | } 26 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/6/ft_putstr/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_putstr 2 | Expected files : ft_putstr.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that displays a string on the standard output. 7 | 8 | The pointer passed to the function contains the address of the string's first 9 | character. 10 | 11 | Your function must be declared as follows: 12 | 13 | void ft_putstr(char *str); 14 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/2/ft_putstr/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_putstr 2 | Expected files : ft_putstr.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that displays a string on the standard output. 7 | 8 | The pointer passed to the function contains the address of the string's first 9 | character. 10 | 11 | Your function must be declared as follows: 12 | 13 | void ft_putstr(char *str); 14 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_putstr/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_putstr 2 | Expected files : ft_putstr.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that displays a string on the standard output. 7 | 8 | The pointer passed to the function contains the address of the string's first 9 | character. 10 | 11 | Your function must be declared as follows: 12 | 13 | void ft_putstr(char *str); 14 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/camel_to_snake/camel_to_snake.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char **argv) 5 | { 6 | if (argc == 2) 7 | { 8 | for (int i = 0; argv[1][i]; i += 1) 9 | { 10 | if (argv[1][i] >= 'A' 11 | && argv[1][i] <= 'Z') 12 | { 13 | write(STDOUT_FILENO, "_", 1); 14 | argv[1][i] += 32; 15 | } 16 | write(STDOUT_FILENO, &argv[1][i], 1); 17 | } 18 | } 19 | write(STDOUT_FILENO, "\n", 1); 20 | return EXIT_SUCCESS; 21 | } 22 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/print_bits/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : print_bits 2 | Expected files : print_bits.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a byte, and prints it in binary WITHOUT A NEWLINE 7 | AT THE END. 8 | 9 | Your function must be declared as follows: 10 | 11 | void print_bits(unsigned char octet); 12 | 13 | Example, if you pass 2 to print_bits, it will print "00000010" -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/4/ft_atoi/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_atoi 2 | Expected files : ft_atoi.c 3 | Allowed functions: None 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that converts the string argument str to an integer (type int) 7 | and returns it. 8 | 9 | It works much like the standard atoi(const char *str) function, see the man. 10 | 11 | Your function must be declared as follows: 12 | 13 | int ft_atoi(const char *str); 14 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/7/print_bits/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : print_bits 2 | Expected files : print_bits.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a byte, and prints it in binary WITHOUT A NEWLINE 7 | AT THE END. 8 | 9 | Your function must be declared as follows: 10 | 11 | void print_bits(unsigned char octet); 12 | 13 | Example, if you pass 2 to print_bits, it will print "00000010" 14 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/ft_atoi/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_atoi 2 | Expected files : ft_atoi.c 3 | Allowed functions: None 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that converts the string argument str to an integer (type int) 7 | and returns it. 8 | 9 | It works much like the standard atoi(const char *str) function, see the man. 10 | 11 | Your function must be declared as follows: 12 | 13 | int ft_atoi(const char *str); 14 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/print_bits/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : print_bits 2 | Expected files : print_bits.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a byte, and prints it in binary WITHOUT A NEWLINE 7 | AT THE END. 8 | 9 | Your function must be declared as follows: 10 | 11 | void print_bits(unsigned char octet); 12 | 13 | Example, if you pass 2 to print_bits, it will print "00000010" 14 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_atoi/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_atoi 2 | Expected files : ft_atoi.c 3 | Allowed functions: None 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that converts the string argument str to an integer (type int) 7 | and returns it. 8 | 9 | It works much like the standard atoi(const char *str) function, see the man. 10 | 11 | Your function must be declared as follows: 12 | 13 | int ft_atoi(const char *str); 14 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/is_power_of_2/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : is_power_of_2 2 | Expected files : is_power_of_2.c 3 | Allowed functions: None 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that determines if a given number is a power of 2. 7 | 8 | This function returns 1 if the given number is a power of 2, otherwise it returns 0. 9 | 10 | Your function must be declared as follows: 11 | 12 | int is_power_of_2(unsigned int n); 13 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/7/is_power_of_2/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : is_power_of_2 2 | Expected files : is_power_of_2.c 3 | Allowed functions: None 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that determines if a given number is a power of 2. 7 | 8 | This function returns 1 if the given number is a power of 2, otherwise it returns 0. 9 | 10 | Your function must be declared as follows: 11 | 12 | int is_power_of_2(unsigned int n); 13 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/is_power_of_2/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : is_power_of_2 2 | Expected files : is_power_of_2.c 3 | Allowed functions: None 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that determines if a given number is a power of 2. 7 | 8 | This function returns 1 if the given number is a power of 2, otherwise it returns 0. 9 | 10 | Your function must be declared as follows: 11 | 12 | int is_power_of_2(unsigned int n); 13 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/2/sort_int_tab/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : sort_int_tab 2 | Expected files : sort_int_tab.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | void sort_int_tab(int *tab, unsigned int size); 9 | 10 | It must sort (in-place) the 'tab' int array, that contains exactly 'size' 11 | members, in ascending order. 12 | 13 | Doubles must be preserved. 14 | 15 | Input is always coherent. 16 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/hidenp/hidenp.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | void hidenp(char *probe, char *target) 5 | { 6 | while (*probe != '\0') 7 | { 8 | while (*probe != *target && *target != '\0') 9 | ++target; 10 | if (*target == '\0') 11 | { 12 | write(1, "0", 1); 13 | return; 14 | } 15 | ++target; 16 | ++probe; 17 | } 18 | write(1, "1", 1); 19 | } 20 | 21 | int main(int argc, char **argv) 22 | { 23 | if (argc == 3) 24 | hidenp(argv[1], argv[2]); 25 | write(1, "\n", 1); 26 | return (0); 27 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/7/max/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : max 2 | Expected files : max.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | int max(int* tab, unsigned int len); 9 | 10 | The first parameter is an array of int, the second is the number of elements in 11 | the array. 12 | 13 | The function returns the largest number found in the array. 14 | 15 | If the array is empty, the function returns 0. 16 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/max/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : max 2 | Expected files : max.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | int max(int* tab, unsigned int len); 9 | 10 | The first parameter is an array of int, the second is the number of elements in 11 | the array. 12 | 13 | The function returns the largest number found in the array. 14 | 15 | If the array is empty, the function returns 0. 16 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/rot_13/rot_13.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | int i; 6 | 7 | i = 0; 8 | if (ac == 2) 9 | { 10 | while(av[1][i] != '\0') 11 | { 12 | if ((av[1][i] >= 'a' && av[1][i]<= 'm') || (av[1][i] >= 'A' && av[1][i]<= 'M')) 13 | av[1][i] = av[1][i] + 13; 14 | else if ((av[1][i] >= 'n' && av[1][i]<= 'z') || (av[1][i] >= 'N' && av[1][i]<= 'Z')) 15 | av[1][i] = av[1][i] - 13; 16 | write(1, &av[1][i], 1); 17 | i++; 18 | } 19 | } 20 | write(1, "\n", 1); 21 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/max/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : max 2 | Expected files : max.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | int max(int* tab, unsigned int len); 9 | 10 | The first parameter is an array of int, the second is the number of elements in 11 | the array. 12 | 13 | The function returns the largest number found in the array. 14 | 15 | If the array is empty, the function returns 0. 16 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/cpp_module01/main.cpp: -------------------------------------------------------------------------------- 1 | #include "Warlock.hpp" 2 | #include "Fwoosh.hpp" 3 | #include "Dummy.hpp" 4 | #include "ATarget.hpp" 5 | #include "ASpell.hpp" 6 | 7 | int main() 8 | { 9 | Warlock richard("Richard", "the Titled"); 10 | 11 | Dummy bob; 12 | Fwoosh* fwoosh = new Fwoosh(); 13 | 14 | richard.learnSpell(fwoosh); 15 | 16 | richard.introduce(); 17 | richard.launchSpell("Fwoosh", bob); 18 | 19 | richard.forgetSpell("Fwoosh"); 20 | richard.launchSpell("Fwoosh", bob); 21 | delete fwoosh; 22 | } 23 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/need_correction/sort_int_tab/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : sort_int_tab 2 | Expected files : sort_int_tab.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | void sort_int_tab(int *tab, unsigned int size); 9 | 10 | It must sort (in-place) the 'tab' int array, that contains exactly 'size' 11 | members, in ascending order. 12 | 13 | Doubles must be preserved. 14 | 15 | Input is always coherent. 16 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_strcpy/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='ft_strcpy.c' 2 | ASSIGN='ft_strcpy' 3 | 4 | bash .system/auto_correc_main.sh $FILE $ASSIGN "Ceci permet de decouvrir le fonctionnement de ton ft_strcpy." 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_main.sh $FILE $ASSIGN "OH ! Tu devrais avoir reussi ce test." 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | touch .system/grading/passed; 17 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strdup/ft_strdup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *ft_strdup(char *src) 5 | { 6 | int i; 7 | char *dest; 8 | 9 | i = 0; 10 | while (src[i] != '\0') 11 | i++; 12 | dest = malloc(sizeof (char) * (i + 1)); 13 | if (dest == NULL) 14 | return (NULL); 15 | i = 0; 16 | while (src[i] != '\0') 17 | { 18 | dest[i] = src[i]; 19 | i++; 20 | } 21 | dest[i] = src[i]; 22 | return (dest); 23 | } 24 | 25 | /*int main(void) 26 | { 27 | printf("%s\n", ft_strdup("This is a test!")); 28 | }*/ 29 | -------------------------------------------------------------------------------- /.system/exam_token/.demo_token: -------------------------------------------------------------------------------- 1 | #a demo token 2 | 3 | 4 | 1662208475 #starting time 5 | 1662219275 #ending time 6 | 2 #exam_number 7 | 1 #student or not 8 | 0 #actual level 9 | 0 #actual assignement 10 | ulstr #name of current ex 11 | 4 #level max of the exam 12 | 1662208487 #time of last grademe 13 | 25 #potentiel points after success 14 | 25 #xp by level 15 | 0 #number of cheat command used 16 | 17 | 18 | # Parsing can't parse # comments 19 | # file must be the name actuel_token.txt -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/0/ft_print_numbers/tester.sh: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | FILE='ft_print_numbers.c' 3 | ASSIGN='ft_print_numbers' 4 | 5 | bash .system/auto_correc_main.sh $FILE $ASSIGN 6 | if [ -e .system/grading/traceback ];then 7 | mv .system/grading/traceback . 8 | exit 1 9 | fi 10 | bash .system/auto_correc_main.sh $FILE $ASSIGN "abc" 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | touch .system/grading/passed; 17 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_rrange/ft_rrange.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int absolute_value(int n); 4 | 5 | int *ft_rrange(int start, int end) 6 | { 7 | int step; 8 | int number_of_ints; 9 | int *array; 10 | int i; 11 | 12 | number_of_ints = 1 + absolute_value(end - start); 13 | array = malloc(sizeof(int) * number_of_ints); 14 | 15 | if (start > end) 16 | step = 1; 17 | else 18 | step = -1; 19 | 20 | i = 0; 21 | while (i < number_of_ints) 22 | { 23 | array[i] = end; 24 | end = end + step; 25 | ++i; 26 | } 27 | return (array); 28 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/3/paramsum/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : paramsum 2 | Expected files : paramsum.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays the number of arguments passed to it, followed by 7 | a newline. 8 | 9 | If there are no arguments, just display a 0 followed by a newline. 10 | 11 | Example: 12 | 13 | $>./paramsum 1 2 3 5 7 24 14 | 6 15 | $>./paramsum 6 12 24 | cat -e 16 | 3$ 17 | $>./paramsum | cat -e 18 | 0$ 19 | $> 20 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/1/paramsum/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : paramsum 2 | Expected files : paramsum.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays the number of arguments passed to it, followed by 7 | a newline. 8 | 9 | If there are no arguments, just display a 0 followed by a newline. 10 | 11 | Example: 12 | 13 | $>./paramsum 1 2 3 5 7 24 14 | 6 15 | $>./paramsum 6 12 24 | cat -e 16 | 3$ 17 | $>./paramsum | cat -e 18 | 0$ 19 | $> 20 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/paramsum/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : paramsum 2 | Expected files : paramsum.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays the number of arguments passed to it, followed by 7 | a newline. 8 | 9 | If there are no arguments, just display a 0 followed by a newline. 10 | 11 | Example: 12 | 13 | $>./paramsum 1 2 3 5 7 24 14 | 6 15 | $>./paramsum 6 12 24 | cat -e 16 | 3$ 17 | $>./paramsum | cat -e 18 | 0$ 19 | $> 20 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/swap_bits/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : swap_bits 2 | Expected files : swap_bits.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a byte, swaps its halves (like the example) and 7 | returns the result. 8 | 9 | Your function must be declared as follows: 10 | 11 | unsigned char swap_bits(unsigned char octet); 12 | 13 | Example: 14 | 15 | 1 byte 16 | _____________ 17 | 0100 | 0001 18 | \ / 19 | / \ 20 | 0001 | 0100 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/5/swap_bits/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : swap_bits 2 | Expected files : swap_bits.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a byte, swaps its halves (like the example) and 7 | returns the result. 8 | 9 | Your function must be declared as follows: 10 | 11 | unsigned char swap_bits(unsigned char octet); 12 | 13 | Example: 14 | 15 | 1 byte 16 | _____________ 17 | 0100 | 0001 18 | \ / 19 | / \ 20 | 0001 | 0100 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/swap_bits/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : swap_bits 2 | Expected files : swap_bits.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a byte, swaps its halves (like the example) and 7 | returns the result. 8 | 9 | Your function must be declared as follows: 10 | 11 | unsigned char swap_bits(unsigned char octet); 12 | 13 | Example: 14 | 15 | 1 byte 16 | _____________ 17 | 0100 | 0001 18 | \ / 19 | / \ 20 | 0001 | 0100 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/2/fprime/fprime_recursive.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void fprime_recursive(int nb, int a, int i) 5 | { 6 | a++; 7 | while (nb % i != 0 && i < nb) 8 | i++; 9 | if (nb % i == 0) 10 | { 11 | if (a != 1) 12 | printf("*"); 13 | printf("%d", i); 14 | if (nb != i) 15 | fprime(nb / i, a, i); 16 | } 17 | else 18 | printf("%d", nb); 19 | } 20 | 21 | 22 | int main(int ac, char **av) 23 | { 24 | if (ac == 2 && av[1][0] != '\0') 25 | fprime(atoi(av[1]), 0, 2); 26 | printf("\n"); 27 | return (0); 28 | } 29 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/need_correction/sort_int_tab/sort_int_tab.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | void swap_values(int *a, int *b) 4 | { 5 | int swap = *a; 6 | *a = *b; 7 | *b = swap; 8 | } 9 | 10 | void sort_int_tab(int *tab, unsigned int size) 11 | { 12 | unsigned int i; 13 | int swapped = 1; 14 | 15 | while (swapped == 1) 16 | { 17 | i = 1; 18 | swapped = 0; 19 | while (i < size) 20 | { 21 | if (tab[i - 1] > tab[i]) 22 | { 23 | swap_values(&tab[i - 1], &tab[i]); 24 | swapped = 1; 25 | } 26 | ++i; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/5/reverse_bits/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : reverse_bits 2 | Expected files : reverse_bits.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a byte, reverses it, bit by bit (like the 7 | example) and returns the result. 8 | 9 | Your function must be declared as follows: 10 | 11 | unsigned char reverse_bits(unsigned char octet); 12 | 13 | Example: 14 | 15 | 1 byte 16 | _____________ 17 | 0010 0110 18 | || 19 | \/ 20 | 0110 0100 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/reverse_bits/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : reverse_bits 2 | Expected files : reverse_bits.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a byte, reverses it, bit by bit (like the 7 | example) and returns the result. 8 | 9 | Your function must be declared as follows: 10 | 11 | unsigned char reverse_bits(unsigned char octet); 12 | 13 | Example: 14 | 15 | 1 byte 16 | _____________ 17 | 0010 0110 18 | || 19 | \/ 20 | 0110 0100 21 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/SpellBook.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ASpell.hpp" 4 | #include 5 | 6 | class SpellBook 7 | { 8 | private: 9 | std::map arr_spell; 10 | 11 | SpellBook(SpellBook const &other); 12 | SpellBook &operator=(SpellBook const &other); 13 | 14 | public: 15 | SpellBook(); 16 | ~SpellBook(); 17 | 18 | void learnSpell(ASpell *aspell_ptr); 19 | void forgetSpell(std::string const &name); 20 | ASpell* createSpell(std::string const &name); 21 | 22 | }; -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/repeat_alpha/repeat_alpha.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | int i; 6 | int k; 7 | char *str; 8 | 9 | i = 0; 10 | k = 1; 11 | if (ac ==2) 12 | { 13 | str = av[1]; 14 | while (str[i] != '\0') 15 | { 16 | k = 1; 17 | if (str[i] >= 'A' && str[i] <= 'Z') 18 | k = str[i] - 64; 19 | if (str[i] >= 'a' && str[i] <= 'z') 20 | k = str[i] - 96; 21 | while (k >= 1) 22 | { 23 | write(1, &str[i], 1); 24 | k--; 25 | } 26 | i++; 27 | } 28 | } 29 | write(1, "\n", 1); 30 | return (0); 31 | } 32 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/rev_print/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : rev_print 2 | Expected files : rev_print.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string, and displays the string in reverse 7 | followed by a newline. 8 | 9 | If the number of parameters is not 1, the program displays a newline. 10 | 11 | Examples: 12 | 13 | $> ./rev_print "zaz" | cat -e 14 | zaz$ 15 | $> ./rev_print "dub0 a POIL" | cat -e 16 | LIOP a 0bud$ 17 | $> ./rev_print | cat -e 18 | $ 19 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/0/cpp_module00/main.cpp: -------------------------------------------------------------------------------- 1 | #include "Warlock.hpp" 2 | 3 | int main() 4 | { 5 | std::string lol; 6 | Warlock const richard("Richard", "Mistress of Magma"); 7 | richard.introduce(); 8 | std::cout << richard.getName() << " - " << richard.getTitle() << std::endl; 9 | 10 | Warlock* jack = new Warlock("Jack", "the Long"); 11 | jack->introduce(); 12 | jack->setTitle("the Mighty"); 13 | jack->introduce(); 14 | 15 | if (jack->getName() == "Jack") 16 | std::cout << "getName is const" << std::endl; 17 | 18 | delete jack; 19 | 20 | return (0); 21 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/7/rev_print/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : rev_print 2 | Expected files : rev_print.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string, and displays the string in reverse 7 | followed by a newline. 8 | 9 | If the number of parameters is not 1, the program displays a newline. 10 | 11 | Examples: 12 | 13 | $> ./rev_print "zaz" | cat -e 14 | zaz$ 15 | $> ./rev_print "dub0 a POIL" | cat -e 16 | LIOP a 0bud$ 17 | $> ./rev_print | cat -e 18 | $ 19 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/3/rev_print/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : rev_print 2 | Expected files : rev_print.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string, and displays the string in reverse 7 | followed by a newline. 8 | 9 | If the number of parameters is not 1, the program displays a newline. 10 | 11 | Examples: 12 | 13 | $> ./rev_print "zaz" | cat -e 14 | zaz$ 15 | $> ./rev_print "dub0 a POIL" | cat -e 16 | LIOP a 0bud$ 17 | $> ./rev_print | cat -e 18 | $ 19 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/2/ft_split/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_split 2 | Expected files : ft_split.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a string, splits it into words, and returns them as 7 | a NULL-terminated array of strings. 8 | 9 | A "word" is defined as a part of a string delimited either by spaces/tabs/new 10 | lines, or by the start/end of the string. 11 | 12 | Your function must be declared as follows: 13 | 14 | char **ft_split(char *str); 15 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_list_size/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | typedef struct s_list 5 | { 6 | struct s_list *next; 7 | void *data; 8 | } t_list; 9 | 10 | 11 | int ft_list_size(t_list *begin_list); 12 | 13 | int main(void) 14 | { 15 | int n = 0; 16 | 17 | t_list *c = malloc(sizeof(*c)); 18 | c->next = 0; 19 | c->data = &n; 20 | 21 | t_list *b = malloc(sizeof(*b)); 22 | b->next = c; 23 | b->data = &n; 24 | 25 | t_list *a = malloc(sizeof(*a)); 26 | a->next = b; 27 | a->data = &n; 28 | 29 | printf("%d\n", ft_list_size(a)); 30 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/ft_split/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_split 2 | Expected files : ft_split.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a string, splits it into words, and returns them as 7 | a NULL-terminated array of strings. 8 | 9 | A "word" is defined as a part of a string delimited either by spaces/tabs/new 10 | lines, or by the start/end of the string. 11 | 12 | Your function must be declared as follows: 13 | 14 | char **ft_split(char *str); 15 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/last_word/last_word.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | int i; 6 | 7 | i = 0; 8 | if (ac == 2) 9 | { 10 | while (av[1][i] != '\0') 11 | i++; 12 | i--; 13 | while ((av[1][i] == ' ' || av[1][i] == '\t') && i != 0) 14 | i--; 15 | while (av[1][i] != ' ' && av[1][i] != '\t' && i != 0) 16 | i--; 17 | if (av[1][i] == ' ' || av[1][i] == '\t') 18 | i++; 19 | while (av[1][i] != '\0' && av[1][i] != ' ' && av[1][i] != '\t') 20 | { 21 | write(1, &av[1][i], 1); 22 | i++; 23 | } 24 | } 25 | write(1, "\n", 1); 26 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/max/main.c: -------------------------------------------------------------------------------- 1 | 2 | int max(int* tab, unsigned int len); 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | if (argc < 3) 9 | return(0); 10 | int *tab = malloc(sizeof(int) * (argc - 1)); 11 | 12 | printf("max( {"); 13 | for (unsigned int i = 2; i < argc; i++) 14 | { 15 | printf("%s", argv[i]); 16 | if (i != argc - 1) 17 | printf(";"); 18 | tab[i - 2] = atoi(argv[i]); 19 | } 20 | printf("} , %s) = %d\n", argv[1], max(tab, atoi(argv[1]))); 21 | return(0); 22 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/need_correction/ft_split/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_split 2 | Expected files : ft_split.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a string, splits it into words, and returns them as 7 | a NULL-terminated array of strings. 8 | 9 | A "word" is defined as a part of a string delimited either by spaces/tabs/new 10 | lines, or by the start/end of the string. 11 | 12 | Your function must be declared as follows: 13 | 14 | char **ft_split(char *str); 15 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/ft_split/attachment/subject.pt.txt: -------------------------------------------------------------------------------- 1 | Nome do exercício: ft_split 2 | Arquivos esperados: ft_split.c 3 | Funções permitidas: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Escreva uma função que recebe uma string, divide-a em palavras e as retorna como 7 | um array de strings terminado em NULL. 8 | 9 | Uma "palavra" é definida como uma parte de uma string delimitada por espaços/tabs/novas 10 | linhas, ou pelo início/fim da string. 11 | 12 | Sua função deve ser declarada da seguinte forma: 13 | 14 | char **ft_split(char *str); 15 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_range/ft_range.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int *ft_range(int start, int end) 5 | { 6 | int size; 7 | int *res; 8 | int i; 9 | 10 | size = abs((end - start)) + 1; 11 | res = malloc(size * sizeof(int)); 12 | if (!res) 13 | return (NULL); 14 | i = 0; 15 | if (start < end) 16 | { 17 | while (start <= end) 18 | { 19 | res[i] = start; 20 | start += 1; 21 | i += 1; 22 | } 23 | } 24 | else 25 | { 26 | while (start >= end) 27 | { 28 | res[i] = start; 29 | start -= 1; 30 | i += 1; 31 | } 32 | } 33 | return (res); 34 | } 35 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/print_hex/print_hex.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | #include 4 | 5 | int ft_atoi(char *str) 6 | { 7 | int n = 0; 8 | 9 | while (*str != '\0') 10 | { 11 | n = n * 10; 12 | n = n + *str - '0'; 13 | ++str; 14 | } 15 | return (n); 16 | } 17 | 18 | void print_hex(int n) 19 | { 20 | char hex_digits[] = "0123456789abcdef"; 21 | 22 | if (n >= 16) 23 | print_hex(n / 16); 24 | write(1, &hex_digits[n % 16], 1); 25 | } 26 | 27 | int main(int argc, char **argv) 28 | { 29 | if (argc == 2) 30 | print_hex(ft_atoi(argv[1])); 31 | 32 | write(1, "\n", 1); 33 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/5/ulstr/ulstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_putchar(char c) 4 | { 5 | write(1, &c, 1); 6 | } 7 | 8 | int main(int ac, char **av) 9 | { 10 | int index; 11 | 12 | index = 0; 13 | if (ac == 2) 14 | { 15 | while (av[1][index] != '\0') 16 | { 17 | if (av[1][index] >= 'A' && av[1][index] <= 'Z') 18 | ft_putchar(av[1][index] - 'A' + 'a'); 19 | else if (av[1][index] >= 'a' && av[1][index] <= 'z') 20 | ft_putchar(av[1][index] - 'a' + 'A'); 21 | else 22 | ft_putchar(av[1][index]); 23 | index++; 24 | } 25 | } 26 | ft_putchar('\n'); 27 | return (0); 28 | } 29 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/search_and_replace/search_and_replace.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | int i; 6 | 7 | i = 0; 8 | if (ac == 4) 9 | { 10 | if(((av[2][0] >= 'a' && av[2][0]<= 'z') || (av[2][0] >= 'A' && av[2][0]<= 'Z')) && av[2][1] == '\0') 11 | if (((av[3][0] >= 'a' && av[2][0]<= 'z') || (av[3][0] >= 'A' && av[3][0]<= 'Z')) && av[3][1] == '\0') 12 | { 13 | while (av[1][i] != '\0') 14 | { 15 | if (av[1][i] == av[2][0]) 16 | av[1][i] = av[3][0]; 17 | write(1, &av[1][i], 1); 18 | i++; 19 | } 20 | } 21 | } 22 | write(1, "\n", 1); 23 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/swap_bits/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='swap_bits.c' 2 | ASSIGN='swap_bits' 3 | 4 | bash .system/auto_correc_main.sh $FILE $ASSIGN "a" 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_main.sh $FILE $ASSIGN "0" 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | bash .system/auto_correc_main.sh $FILE $ASSIGN "P" 17 | if [ -e .system/grading/traceback ];then 18 | mv .system/grading/traceback . 19 | exit 1 20 | fi 21 | 22 | touch .system/grading/passed; 23 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_rrange/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int *ft_rrange(int start, int end); 5 | int absolute_value(int n) 6 | { 7 | if (n < 0) 8 | return (-n); 9 | return (n); 10 | } 11 | 12 | int main(int argc, char **argv) 13 | { 14 | int start = atoi(argv[1]); 15 | int end = atoi(argv[2]); 16 | 17 | int *arr = ft_rrange(start, end); 18 | 19 | int i = 0; 20 | while (i < 1 + absolute_value(end - start)) 21 | { 22 | printf("%d", arr[i]); 23 | if (i < 1 + absolute_value(end - start) - 1) 24 | printf(", "); 25 | ++i; 26 | } 27 | printf("\n"); 28 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/do_op/do_op.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int ac, char **av) 6 | { 7 | int n1 = 0; 8 | int n2 = 0; 9 | int res = 0; 10 | 11 | if (ac == 4) 12 | { 13 | n1 = atoi(av[1]); 14 | n2 = atoi(av[3]); 15 | if (av[2][0] == '+') 16 | res = n1 + n2; 17 | else if (av[2][0] == '-') 18 | res = n1 - n2; 19 | else if (av[2][0] == '*') 20 | res = n1 * n2; 21 | else if (av[2][0]== '/') 22 | res = n1 / n2; 23 | else if (av[2][0] == '%') 24 | res = n1 % n2; 25 | printf("%d\n", res); 26 | } 27 | else 28 | write(1, "\n", 1); 29 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/sort_list/tester.sh: -------------------------------------------------------------------------------- 1 | 2 | FILE='sort_list.c' 3 | ASSIGN='sort_list' 4 | 5 | # Copy the file list.h from GradeMe to the student's folder thanks to @Kuninoto Issue 6 | cp .system/grading/list.h rendu/$ASSIGN/list.h 7 | 8 | bash .system/auto_correc_main.sh $FILE $ASSIGN 9 | if [ -e .system/grading/traceback ];then 10 | mv .system/grading/traceback . 11 | # Remove the file list.h from the student's folder 12 | rm -f rendu/$ASSIGN/list.h 13 | exit 1 14 | fi 15 | 16 | # Remove the file list.h from the student's folder 17 | rm -f rendu/$ASSIGN/list.h 18 | 19 | touch .system/grading/passed; 20 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strdup/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='ft_strdup.c' 2 | ASSIGN='ft_strdup' 3 | 4 | bash .system/auto_correc_main.sh $FILE $ASSIGN "hello World" 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_main.sh $FILE $ASSIGN "" 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | bash .system/auto_correc_main.sh $FILE $ASSIGN "test" 17 | if [ -e .system/grading/traceback ];then 18 | mv .system/grading/traceback . 19 | exit 1 20 | fi 21 | 22 | touch .system/grading/passed; 23 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/cpp_module01/ATarget.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class ASpell; 6 | 7 | class ATarget 8 | { 9 | private: 10 | std::string type; 11 | 12 | public: 13 | ATarget(); 14 | ATarget(std::string const &type); 15 | ATarget(ATarget const &other); 16 | ATarget &operator=(ATarget const &other); 17 | virtual ~ATarget(); 18 | 19 | std::string const &getType() const; 20 | 21 | void getHitBySpell(ASpell const &aspell_ref) const; 22 | 23 | virtual ATarget *clone() const = 0; 24 | }; 25 | 26 | #include "ASpell.hpp" -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/ATarget.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class ASpell; 6 | 7 | class ATarget 8 | { 9 | private: 10 | std::string type; 11 | 12 | public: 13 | ATarget(); 14 | ATarget(std::string const &type); 15 | ATarget(ATarget const &other); 16 | ATarget &operator=(ATarget const &other); 17 | virtual ~ATarget(); 18 | 19 | std::string const &getType() const; 20 | 21 | void getHitBySpell(ASpell const &aspell_ref) const; 22 | 23 | virtual ATarget *clone() const = 0; 24 | }; 25 | 26 | #include "ASpell.hpp" -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/TargetGenerator.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ATarget.hpp" 4 | #include 5 | 6 | class TargetGenerator 7 | { 8 | private: 9 | std::map arr_target; 10 | 11 | TargetGenerator(TargetGenerator const &other); 12 | TargetGenerator &operator=(TargetGenerator const &other); 13 | 14 | public: 15 | TargetGenerator(); 16 | ~TargetGenerator(); 17 | 18 | void learnTargetType(ATarget *target_ptr); 19 | void forgetTargetType(std::string const &name); 20 | ATarget* createTarget(std::string const &name); 21 | }; -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_list_size/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_list_size 2 | Expected files : ft_list_size.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that returns the number of elements in the linked list that's 7 | passed to it. 8 | 9 | It must be declared as follows: 10 | 11 | int ft_list_size(t_list *begin_list); 12 | 13 | You must use the following structure in your program ft_list_size.c : 14 | 15 | typedef struct s_list 16 | { 17 | struct s_list *next; 18 | void *data; 19 | } t_list; 20 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/0/cpp_module00/Warlock.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Warlock 6 | { 7 | private: 8 | std::string name; 9 | std::string title; 10 | 11 | Warlock(); 12 | Warlock(Warlock const &other); 13 | Warlock &operator=(Warlock const &other); 14 | public: 15 | Warlock(std::string const &name, std::string const &title); 16 | ~Warlock(); 17 | 18 | std::string const &getName() const; 19 | std::string const &getTitle() const; 20 | 21 | void setTitle(std::string const &title); 22 | 23 | void introduce() const; 24 | }; -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/cpp_module01/ATarget.cpp: -------------------------------------------------------------------------------- 1 | #include "ATarget.hpp" 2 | 3 | ATarget::ATarget() {} 4 | 5 | ATarget::ATarget(std::string const &type) { this->type = type;} 6 | 7 | ATarget::ATarget(ATarget const &other) { *this = other;} 8 | 9 | ATarget &ATarget::operator=(ATarget const &other) 10 | { 11 | this->type = other.type; 12 | return (*this); 13 | } 14 | 15 | ATarget::~ATarget() {} 16 | 17 | std::string const &ATarget::getType() const { return (this->type);} 18 | 19 | void ATarget::getHitBySpell(ASpell const &aspell_ref) const 20 | { 21 | std::cout << this->type << " has been " << aspell_ref.getEffects() << "!\n"; 22 | } 23 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/ATarget.cpp: -------------------------------------------------------------------------------- 1 | #include "ATarget.hpp" 2 | 3 | ATarget::ATarget() {} 4 | 5 | ATarget::ATarget(std::string const &type) { this->type = type;} 6 | 7 | ATarget::ATarget(ATarget const &other) { *this = other;} 8 | 9 | ATarget &ATarget::operator=(ATarget const &other) 10 | { 11 | this->type = other.type; 12 | return (*this); 13 | } 14 | 15 | ATarget::~ATarget() {} 16 | 17 | std::string const &ATarget::getType() const { return (this->type);} 18 | 19 | void ATarget::getHitBySpell(ASpell const &aspell_ref) const 20 | { 21 | std::cout << this->type << " has been " << aspell_ref.getEffects() << "!\n"; 22 | } 23 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/2/aff_last_param/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : aff_last_param 2 | Expected files : aff_last_param.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes strings as arguments, and displays its last 7 | argument followed by a newline. 8 | 9 | If the number of arguments is less than 1, the program displays a newline. 10 | 11 | Examples: 12 | 13 | $> ./aff_last_param "zaz" "mange" "des" "chats" | cat -e 14 | chats$ 15 | $> ./aff_last_param "j'aime le savon" | cat -e 16 | j'aime le savon$ 17 | $> ./aff_last_param 18 | $ 19 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/fizzbuzz/fizzbuzz.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | int i; 6 | int k; 7 | int l; 8 | 9 | i = 1; 10 | while (i <= 100) 11 | { 12 | if ((i % 3 == 0) && (i % 5 == 0)) 13 | write(1, "fizzbuzz", 8); 14 | else if (i % 3 == 0) 15 | write(1, "fizz", 4); 16 | else if (i % 5 == 0) 17 | write(1, "buzz", 4); 18 | else if (i > 10) 19 | { 20 | k = i / 10 + '0'; 21 | l = i % 10 + '0'; 22 | write (1, &k, 1); 23 | write (1, &l, 1); 24 | } 25 | else 26 | 27 | { 28 | k = i + '0'; 29 | write(1, &k, 1); 30 | } 31 | write(1,"\n" 32 | 33 | , 1); 34 | i++; 35 | } 36 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_putstr/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='ft_putstr.c' 2 | ASSIGN='ft_putstr' 3 | 4 | bash .system/auto_correc_main.sh $FILE $ASSIGN "Hello World!" 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_main.sh $FILE $ASSIGN "Testinnnnng your puuuuuutstr!! :)" 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | bash .system/auto_correc_main.sh $FILE $ASSIGN 17 | if [ -e .system/grading/traceback ];then 18 | mv .system/grading/traceback . 19 | exit 1 20 | fi 21 | 22 | touch .system/grading/passed; 23 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strcspn/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='ft_strcspn.c' 2 | ASSIGN='ft_strcspn' 3 | 4 | bash .system/auto_correc_main.sh $FILE $ASSIGN "hello World" "hello world" 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_main.sh $FILE $ASSIGN "test" "es" 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | bash .system/auto_correc_main.sh $FILE $ASSIGN "test" "f" 17 | if [ -e .system/grading/traceback ];then 18 | mv .system/grading/traceback . 19 | exit 1 20 | fi 21 | 22 | touch .system/grading/passed; 23 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/ft_strcmp/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='ft_strcmp.c' 2 | ASSIGN='ft_strcmp' 3 | 4 | bash .system/auto_correc_main.sh $FILE $ASSIGN "hello World" "hello world" 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_main.sh $FILE $ASSIGN "hello World" "" 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | bash .system/auto_correc_main.sh $FILE $ASSIGN "13268!" "+13268!" 17 | if [ -e .system/grading/traceback ];then 18 | mv .system/grading/traceback . 19 | exit 1 20 | fi 21 | 22 | touch .system/grading/passed; 23 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/print_hex/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : print_hex 2 | Expected files : print_hex.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a positive (or zero) number expressed in base 10, 7 | and displays it in base 16 (lowercase letters) followed by a newline. 8 | 9 | If the number of parameters is not 1, the program displays a newline. 10 | 11 | Examples: 12 | 13 | $> ./print_hex "10" | cat -e 14 | a$ 15 | $> ./print_hex "255" | cat -e 16 | ff$ 17 | $> ./print_hex "5156454" | cat -e 18 | 4eae66$ 19 | $> ./print_hex | cat -e 20 | $ 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/5/search_and_replace/search_and_replace.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char **argv) { 4 | int i; 5 | 6 | // we only need three parameters 7 | if (argc != 4) { 8 | write(1, "\n", 1); 9 | return 0; 10 | } 11 | 12 | // the second and third arguments must be letters 13 | if (argv[2][1] != '\0' || argv[3][1] != '\0') { 14 | write(1, "\n", 1); 15 | return 0; 16 | } 17 | 18 | // find and replace 19 | i = 0; 20 | while (argv[1][i] != '\0') { 21 | if (argv[1][i] == argv[2][0]) 22 | argv[1][i] = argv[3][0]; 23 | write(1, &argv[1][i], 1); 24 | i++; 25 | } 26 | 27 | write(1, "\n", 1); 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/ft_list_size/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_list_size 2 | Expected files : ft_list_size.c, ft_list.h 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that returns the number of elements in the linked list that's 7 | passed to it. 8 | 9 | It must be declared as follows: 10 | 11 | int ft_list_size(t_list *begin_list); 12 | 13 | You must use the following structure, and turn it in as a file called 14 | ft_list.h: 15 | 16 | typedef struct s_list 17 | { 18 | struct s_list *next; 19 | void *data; 20 | } t_list; 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/print_hex/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : print_hex 2 | Expected files : print_hex.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a positive (or zero) number expressed in base 10, 7 | and displays it in base 16 (lowercase letters) followed by a newline. 8 | 9 | If the number of parameters is not 1, the program displays a newline. 10 | 11 | Examples: 12 | 13 | $> ./print_hex "10" | cat -e 14 | a$ 15 | $> ./print_hex "255" | cat -e 16 | ff$ 17 | $> ./print_hex "5156454" | cat -e 18 | 4eae66$ 19 | $> ./print_hex | cat -e 20 | $ 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/ft_list_size/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_list_size 2 | Expected files : ft_list_size.c, ft_list.h 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that returns the number of elements in the linked list that's 7 | passed to it. 8 | 9 | It must be declared as follows: 10 | 11 | int ft_list_size(t_list *begin_list); 12 | 13 | You must use the following structure, and turn it in as a file called 14 | ft_list.h: 15 | 16 | typedef struct s_list 17 | { 18 | struct s_list *next; 19 | void *data; 20 | } t_list; 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/print_hex/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : print_hex 2 | Expected files : print_hex.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a positive (or zero) number expressed in base 10, 7 | and displays it in base 16 (lowercase letters) followed by a newline. 8 | 9 | If the number of parameters is not 1, the program displays a newline. 10 | 11 | Examples: 12 | 13 | $> ./print_hex "10" | cat -e 14 | a$ 15 | $> ./print_hex "255" | cat -e 16 | ff$ 17 | $> ./print_hex "5156454" | cat -e 18 | 4eae66$ 19 | $> ./print_hex | cat -e 20 | $ 21 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/sort_list/sort_list.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | #include "list.h" 4 | 5 | void swap_values(t_list *a, t_list *b) 6 | { 7 | int swap = a->data; 8 | a->data = b->data; 9 | b->data = swap; 10 | } 11 | 12 | t_list *sort_list(t_list* lst, int (*cmp)(int, int)) 13 | { 14 | int swapped = 1; 15 | t_list *cur = lst; 16 | 17 | while (swapped == 1) 18 | { 19 | swapped = 0; 20 | while (cur != 0 && cur->next != 0) 21 | { 22 | if (cmp(cur->data, cur->next->data) == 0) 23 | { 24 | swap_values(cur, cur->next); 25 | swapped = 1; 26 | } 27 | cur = cur->next; 28 | } 29 | cur = lst; 30 | } 31 | return (lst); 32 | } 33 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/2/aff_first_param/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : aff_first_param 2 | Expected files : aff_first_param.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes strings as arguments, and displays its first 7 | argument followed by a \n. 8 | 9 | If the number of arguments is less than 1, the program displays \n. 10 | 11 | Example: 12 | 13 | $> ./aff_first_param vincent mit "l'ane" dans un pre et "s'en" vint | cat -e 14 | vincent$ 15 | $> ./aff_first_param "j'aime le fromage de chevre" | cat -e 16 | j'aime le fromage de chevre$ 17 | $> ./aff_first_param 18 | $ 19 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/max/tester.sh: -------------------------------------------------------------------------------- 1 | 2 | FILE='max.c' 3 | ASSIGN='max' 4 | 5 | bash .system/auto_correc_main.sh $FILE $ASSIGN "7" "-42" "0" "-5" "-64" "-2" "-68" "-1" 6 | if [ -e .system/grading/traceback ];then 7 | mv .system/grading/traceback . 8 | exit 1 9 | fi 10 | 11 | bash .system/auto_correc_main.sh $FILE $ASSIGN "6" "-42" "0" "-5" "-64" "-2" "-68" 12 | if [ -e .system/grading/traceback ];then 13 | mv .system/grading/traceback . 14 | exit 1 15 | fi 16 | 17 | bash .system/auto_correc_main.sh $FILE $ASSIGN "4" "7" "42" "0" "-5" 18 | if [ -e .system/grading/traceback ];then 19 | mv .system/grading/traceback . 20 | exit 1 21 | fi 22 | 23 | touch .system/grading/passed; 24 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/ft_strlen/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='ft_strlen.c' 2 | ASSIGN='ft_strlen' 3 | 4 | bash .system/auto_correc_main.sh $FILE $ASSIGN "Ceci permet de decouvrir le fonctionnement de ton ft_strlen." 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_main.sh $FILE $ASSIGN "OH ! Tu devrais avoir reussi ce test." 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | bash .system/auto_correc_main.sh $FILE $ASSIGN 17 | if [ -e .system/grading/traceback ];then 18 | mv .system/grading/traceback . 19 | exit 1 20 | fi 21 | 22 | touch .system/grading/passed; 23 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_atoi_base/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='ft_atoi_base.c' 2 | ASSIGN='ft_atoi_base' 3 | 4 | bash .system/auto_correc_main.sh $FILE $ASSIGN "Ceci permet de decouvrir le fonctionnement de ton ft_atoi_base." "16" 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_main.sh $FILE $ASSIGN "13268!" "16" 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | bash .system/auto_correc_main.sh $FILE $ASSIGN "-13268!" "10" 17 | if [ -e .system/grading/traceback ];then 18 | mv .system/grading/traceback . 19 | exit 1 20 | fi 21 | 22 | touch .system/grading/passed; 23 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/inter/inter.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | int l; 6 | int k; 7 | int i; 8 | char *s1; 9 | char *s2; 10 | 11 | i = 0; 12 | l = 0; 13 | if (ac == 3) 14 | { 15 | s1 = av[1]; 16 | s2 = av[2]; 17 | while (s1[i] != '\0') 18 | { 19 | k = 0; 20 | while (s2[k] != '\0') 21 | { 22 | if(s1[i] == s2[k]) 23 | { 24 | l = 0; 25 | while (s1[l] != s1[i]) 26 | l++; 27 | if (l == i) 28 | { 29 | l = 0; 30 | while (s2[l] != s2[k]) 31 | l++; 32 | if (l == k) 33 | write(1, &s1[i], 1); 34 | } 35 | } 36 | k++; 37 | } 38 | i++; 39 | } 40 | } 41 | write(1, "\n", 1); 42 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/0/aff_a/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : aff_a 2 | Expected files : aff_a.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string, and displays the first 'a' character it 7 | encounters in it, followed by a newline. If there are no 'a' characters in the 8 | string, the program just writes a newline. If the number of parameters is not 9 | 1, the program displays 'a' followed by a newline. 10 | 11 | Example: 12 | 13 | $> ./aff_a "abc" | cat -e 14 | a$ 15 | $> ./aff_a "dubO a POIL" | cat -e 16 | a$ 17 | $> ./aff_a "zz sent le poney" | cat -e 18 | $ 19 | $> ./aff_a | cat -e 20 | a$ 21 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/cpp_module01/ASpell.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class ATarget; 6 | 7 | class ASpell 8 | { 9 | private: 10 | std::string name; 11 | std::string effects; 12 | 13 | public: 14 | ASpell(); 15 | ASpell(std::string const &name, std::string const &effects); 16 | ASpell(ASpell const &other); 17 | ASpell &operator=(ASpell const &other); 18 | virtual ~ASpell(); 19 | 20 | std::string const &getName() const; 21 | std::string const &getEffects() const; 22 | 23 | void launch(ATarget const &atarget_ref) const; 24 | 25 | virtual ASpell *clone() const = 0; 26 | }; 27 | 28 | #include "ATarget.hpp" -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/ASpell.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class ATarget; 6 | 7 | class ASpell 8 | { 9 | private: 10 | std::string name; 11 | std::string effects; 12 | 13 | public: 14 | ASpell(); 15 | ASpell(std::string const &name, std::string const &effects); 16 | ASpell(ASpell const &other); 17 | ASpell &operator=(ASpell const &other); 18 | virtual ~ASpell(); 19 | 20 | std::string const &getName() const; 21 | std::string const &getEffects() const; 22 | 23 | void launch(ATarget const &atarget_ref) const; 24 | 25 | virtual ASpell *clone() const = 0; 26 | }; 27 | 28 | #include "ATarget.hpp" -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/add_prime_sum/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : add_prime_sum 2 | Expected files : add_prime_sum.c 3 | Allowed functions: write, exit 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a positive integer as argument and displays the sum 7 | of all prime numbers inferior or equal to it followed by a newline. 8 | 9 | If the number of arguments is not 1, or the argument is not a positive number, 10 | just display 0 followed by a newline. 11 | 12 | Yes, the examples are right. 13 | 14 | Examples: 15 | 16 | $>./add_prime_sum 5 17 | 10 18 | $>./add_prime_sum 7 | cat -e 19 | 17$ 20 | $>./add_prime_sum | cat -e 21 | 0$ 22 | $> 23 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/add_prime_sum/attachment/subject.fr.txt: -------------------------------------------------------------------------------- 1 | Assignment name : add_prime_sum 2 | Expected files : add_prime_sum.c 3 | Allowed functions: write, exit 4 | -------------------------------------------------------------------------------- 5 | 6 | Écrire un programme qui prend un entier positif en argument et affiche la somme 7 | de tous les nombres premiers inférieurs ou égaux à ce paramètre, suivie d'un 8 | \n. 9 | 10 | Si le nombre d'arguments n'est pas 1, ou que l'argument n'est pas positif, 11 | afficher 0 et un \n. 12 | 13 | Oui, les exemples sont justes. 14 | 15 | Exemples: 16 | 17 | $>./add_prime_sum 5 18 | 10 19 | $>./add_prime_sum 7 | cat -e 20 | 17$ 21 | $>./add_prime_sum | cat -e 22 | 0$ 23 | $> 24 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/need_correction/ft_split/attachment/subject.fr.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_split 2 | Expected files : ft_split.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Écrire une fonction qui prend en paramètre une chaîne de caractères et la 7 | découpe en mots, qui seront retournés sous la forme d'un tableau de chaînes 8 | terminé par NULL. 9 | 10 | On appelle "mot" une portion de chaîne de caractères délimitée soit par des 11 | espaces, des retours à la ligne et/ou des tabulations, soit par le début / fin 12 | de la chaîne. 13 | 14 | Votre fonction devra être prototypée de la façon suivante : 15 | 16 | char **ft_split(char *str); 17 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/add_prime_sum/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : add_prime_sum 2 | Expected files : add_prime_sum.c 3 | Allowed functions: write, exit 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a positive integer as argument and displays the sum 7 | of all prime numbers inferior or equal to it followed by a newline. 8 | 9 | If the number of arguments is not 1, or the argument is not a positive number, 10 | just display 0 followed by a newline. 11 | 12 | Yes, the examples are right. 13 | 14 | Examples: 15 | 16 | $>./add_prime_sum 5 17 | 10 18 | $>./add_prime_sum 7 | cat -e 19 | 17$ 20 | $>./add_prime_sum | cat -e 21 | 0$ 22 | $> 23 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/add_prime_sum/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : add_prime_sum 2 | Expected files : add_prime_sum.c 3 | Allowed functions: write, exit 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a positive integer as argument and displays the sum 7 | of all prime numbers inferior or equal to it followed by a newline. 8 | 9 | If the number of arguments is not 1, or the argument is not a positive number, 10 | just display 0 followed by a newline. 11 | 12 | Yes, the examples are right. 13 | 14 | Examples: 15 | 16 | $>./add_prime_sum 5 17 | 10 18 | $>./add_prime_sum 7 | cat -e 19 | 17$ 20 | $>./add_prime_sum | cat -e 21 | 0$ 22 | $> 23 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/2/check_mate/attachment/examples.txt: -------------------------------------------------------------------------------- 1 | Pion / Pawn (P): 2 | 3 | . . . . . . . 4 | . . . . . . . 5 | . . X . X . . 6 | . . . P . . . 7 | . . . . . . . 8 | . . . . . . . 9 | . . . . . . . 10 | 11 | Fou / Bishop (B): 12 | 13 | X . . . . . X 14 | . X . . . X . 15 | . . X . X . . 16 | . . . B . . . 17 | . . X . X . . 18 | . X . . . X . 19 | X . . . . . X 20 | 21 | Tour / Rook (R): 22 | 23 | . . . X . . . 24 | . . . X . . . 25 | . . . X . . . 26 | X X X R X X X 27 | . . . X . . . 28 | . . . X . . . 29 | . . . X . . . 30 | 31 | Dame / Queen (Q) 32 | 33 | X . . X . . X 34 | . X . X . X . 35 | . . X X X . . 36 | X X X Q X X X 37 | . . X X X . . 38 | . X . X . X . 39 | X . . X . . X 40 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/2/aff_z/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : aff_z 2 | Expected files : aff_z.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string, and displays the first 'z' 7 | character it encounters in it, followed by a newline. If there are no 8 | 'z' characters in the string, the program writes 'z' followed 9 | by a newline. If the number of parameters is not 1, the program displays 10 | 'z' followed by a newline. 11 | 12 | Example: 13 | 14 | $> ./aff_z "abc" | cat -e 15 | z$ 16 | $> ./aff_z "dubO a POIL" | cat -e 17 | z$ 18 | $> ./aff_z "zaz sent le poney" | cat -e 19 | z$ 20 | $> ./aff_z | cat -e 21 | z$ 22 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/expand_str/expand_str.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int word_len(char *str) 5 | { 6 | int i = 0; 7 | while (str[i] != '\0' && str[i] != ' ' && str[i] != '\t') 8 | ++i; 9 | return (i); 10 | } 11 | 12 | void expand_str(char *str) 13 | { 14 | int len; 15 | int first_word = 1; 16 | 17 | while (*str != '\0') 18 | { 19 | while (*str == ' ' || *str == '\t') 20 | ++str; 21 | len = word_len(str); 22 | if (len > 0 && first_word == 0) 23 | write(1, " ", 3); 24 | first_word = 0; 25 | write(1, str, len); 26 | str = str + len; 27 | } 28 | } 29 | 30 | int main(int argc, char **argv) 31 | { 32 | if (argc == 2) 33 | expand_str(argv[1]); 34 | 35 | write(1, "\n", 1); 36 | return (0); 37 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/5/repeat_alpha/repeat_alpha.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int ft_putchar(char c); 4 | 5 | int ft_putchar(char c) 6 | { 7 | write(1, &c, 1); 8 | return(0); 9 | } 10 | 11 | int letter_count(char c) 12 | { 13 | int repeat; 14 | 15 | if (c >= 'A' && c <= 'Z') 16 | repeat = c - 'A' + 1; 17 | else if (c >= 'a' && c <= 'z') 18 | repeat = c - 'a' + 1; 19 | else 20 | repeat = 1; 21 | return (repeat); 22 | } 23 | 24 | int main(int ac, char **av) 25 | { 26 | int repeat; 27 | 28 | if (ac == 2) 29 | { 30 | while (*av[1]) 31 | { 32 | repeat = letter_count(*av[1]); 33 | while (repeat--) 34 | write(1, av[1], 1); 35 | av[1]++; 36 | } 37 | } 38 | ft_putchar('\n'); 39 | return(0); 40 | } 41 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/pgcd/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : pgcd 2 | Expected files : pgcd.c 3 | Allowed functions: printf, atoi, malloc, free 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes two strings representing two strictly positive 7 | integers that fit in an int. 8 | 9 | Display their highest common denominator followed by a newline (It's always a 10 | strictly positive integer). 11 | 12 | If the number of parameters is not 2, display a newline. 13 | 14 | Examples: 15 | 16 | $> ./pgcd 42 10 | cat -e 17 | 2$ 18 | $> ./pgcd 42 12 | cat -e 19 | 6$ 20 | $> ./pgcd 14 77 | cat -e 21 | 7$ 22 | $> ./pgcd 17 3 | cat -e 23 | 1$ 24 | $> ./pgcd | cat -e 25 | $ 26 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/0/cpp_module00/Warlock.cpp: -------------------------------------------------------------------------------- 1 | #include "Warlock.hpp" 2 | 3 | Warlock::Warlock(std::string const &name, std::string const &title) 4 | { 5 | this->name = name; 6 | this->title = title; 7 | std::cout << this->name << ": This looks like another boring day.\n"; 8 | } 9 | 10 | Warlock::~Warlock() {std::cout << this->name << ": My job here is done!\n";} 11 | 12 | std::string const &Warlock::getName() const { return (this->name);} 13 | std::string const &Warlock::getTitle() const { return (this->title);} 14 | 15 | void Warlock::setTitle(std::string const &title) { this->title = title;} 16 | 17 | void Warlock::introduce() const { std::cout << this->name << ": I am " << this->name << ", " << this->title << "!\n";} 18 | 19 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/pgcd/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : pgcd 2 | Expected files : pgcd.c 3 | Allowed functions: printf, atoi, malloc, free 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes two strings representing two strictly positive 7 | integers that fit in an int. 8 | 9 | Display their highest common denominator followed by a newline (It's always a 10 | strictly positive integer). 11 | 12 | If the number of parameters is not 2, display a newline. 13 | 14 | Examples: 15 | 16 | $> ./pgcd 42 10 | cat -e 17 | 2$ 18 | $> ./pgcd 42 12 | cat -e 19 | 6$ 20 | $> ./pgcd 14 77 | cat -e 21 | 7$ 22 | $> ./pgcd 17 3 | cat -e 23 | 1$ 24 | $> ./pgcd | cat -e 25 | $ 26 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/pgcd/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : pgcd 2 | Expected files : pgcd.c 3 | Allowed functions: printf, atoi, malloc, free 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes two strings representing two strictly positive 7 | integers that fit in an int. 8 | 9 | Display their highest common denominator followed by a newline (It's always a 10 | strictly positive integer). 11 | 12 | If the number of parameters is not 2, display a newline. 13 | 14 | Examples: 15 | 16 | $> ./pgcd 42 10 | cat -e 17 | 2$ 18 | $> ./pgcd 42 12 | cat -e 19 | 6$ 20 | $> ./pgcd 14 77 | cat -e 21 | 7$ 22 | $> ./pgcd 17 3 | cat -e 23 | 1$ 24 | $> ./pgcd | cat -e 25 | $ 26 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_06/0/mini_serv/findport.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | first_port=$1 3 | last_port=$2 4 | goodport=0; 5 | if [ -z "$first_port" ] 6 | then 7 | first_port=8888 8 | fi 9 | if [ -z "$last_port" ] 10 | then 11 | last_port=9999 12 | fi 13 | 14 | if [ $(uname) == "Darwin" ]; then 15 | checkport_tool='lsof -i -n -P' 16 | else 17 | checkport_tool='ss -tuln' 18 | fi 19 | 20 | function scanner 21 | { 22 | for ((port="$first_port"; port<="$last_port"; port++)) 23 | do 24 | checkport=`eval $checkport_tool | grep $port` 25 | if [ -z "$checkport" ]; then 26 | goodport=$port 27 | break 28 | fi 29 | done 30 | } 31 | 32 | 33 | scanner 34 | echo "$goodport" 35 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/need_correction/rev_wstr/rev_wstr.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | #include 4 | #include 5 | 6 | void rev_wstr(char *str) 7 | { 8 | int i = 0; 9 | int j; 10 | int first_word = 1; 11 | 12 | while (str[i] != '\0') 13 | ++i; 14 | 15 | while (i >= 0) 16 | { 17 | while (i >= 0 && (str[i] == '\0' || str[i] == ' ' || str[i] == '\t')) 18 | --i; 19 | j = i; 20 | while (j >= 0 && str[j] != ' ' && str[j] != '\t') 21 | --j; 22 | if (first_word == 0) 23 | write(1, " ", 1); 24 | write(1, str + j + 1, i - j); 25 | first_word = 0; 26 | i = j; 27 | } 28 | } 29 | 30 | int main(int argc, char **argv) 31 | { 32 | if (argc == 2) 33 | rev_wstr(argv[1]); 34 | 35 | write(1, "\n", 1); 36 | return (0); 37 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/cpp_module01/ASpell.cpp: -------------------------------------------------------------------------------- 1 | #include "ASpell.hpp" 2 | 3 | ASpell::ASpell() {} 4 | 5 | ASpell::ASpell(std::string const &name, std::string const &effects) 6 | { 7 | this->name = name; 8 | this->effects = effects; 9 | } 10 | 11 | ASpell::ASpell(ASpell const &other) { *this = other;} 12 | 13 | ASpell &ASpell::operator=(ASpell const &other) 14 | { 15 | this->name = other.name; 16 | this->effects = other.effects; 17 | return (*this); 18 | } 19 | 20 | ASpell::~ASpell() {} 21 | 22 | std::string const &ASpell::getName() const { return (this->name);} 23 | 24 | std::string const &ASpell::getEffects() const { return (this->effects);} 25 | 26 | void ASpell::launch(ATarget const &atarget_ref) const 27 | { 28 | atarget_ref.getHitBySpell((*this)); 29 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/ASpell.cpp: -------------------------------------------------------------------------------- 1 | #include "ASpell.hpp" 2 | 3 | ASpell::ASpell() {} 4 | 5 | ASpell::ASpell(std::string const &name, std::string const &effects) 6 | { 7 | this->name = name; 8 | this->effects = effects; 9 | } 10 | 11 | ASpell::ASpell(ASpell const &other) { *this = other;} 12 | 13 | ASpell &ASpell::operator=(ASpell const &other) 14 | { 15 | this->name = other.name; 16 | this->effects = other.effects; 17 | return (*this); 18 | } 19 | 20 | ASpell::~ASpell() {} 21 | 22 | std::string const &ASpell::getName() const { return (this->name);} 23 | 24 | std::string const &ASpell::getEffects() const { return (this->effects);} 25 | 26 | void ASpell::launch(ATarget const &atarget_ref) const 27 | { 28 | atarget_ref.getHitBySpell((*this)); 29 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/ft_itoa/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='ft_itoa.c' 2 | ASSIGN='ft_itoa' 3 | 4 | bash .system/auto_correc_main.sh $FILE $ASSIGN "16" 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_main.sh $FILE $ASSIGN "13268" 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | bash .system/auto_correc_main.sh $FILE $ASSIGN "-13268" 17 | if [ -e .system/grading/traceback ];then 18 | mv .system/grading/traceback . 19 | exit 1 20 | fi 21 | 22 | bash .system/auto_correc_main.sh $FILE $ASSIGN "0" 23 | if [ -e .system/grading/traceback ];then 24 | mv .system/grading/traceback . 25 | exit 1 26 | fi 27 | 28 | touch .system/grading/passed; 29 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/fizzbuzz/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : fizzbuzz 2 | Expected files : fizzbuzz.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that prints the numbers from 1 to 100, each separated by a 7 | newline. 8 | 9 | If the number is a multiple of 3, it prints 'fizz' instead. 10 | 11 | If the number is a multiple of 5, it prints 'buzz' instead. 12 | 13 | If the number is both a multiple of 3 and a multiple of 5, it prints 'fizzbuzz' instead. 14 | 15 | Example: 16 | 17 | $>./fizzbuzz 18 | 1 19 | 2 20 | fizz 21 | 4 22 | buzz 23 | fizz 24 | 7 25 | 8 26 | fizz 27 | buzz 28 | 11 29 | fizz 30 | 13 31 | 14 32 | fizzbuzz 33 | [...] 34 | 97 35 | 98 36 | fizz 37 | buzz 38 | $> 39 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/4/inter/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : inter 2 | Expected files : inter.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes two strings and displays, without doubles, the 7 | characters that appear in both strings, in the order they appear in the first 8 | one. 9 | 10 | The display will be followed by a \n. 11 | 12 | If the number of arguments is not 2, the program displays \n. 13 | 14 | Examples: 15 | 16 | $>./inter "padinton" "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e 17 | padinto$ 18 | $>./inter ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e 19 | df6ewg4$ 20 | $>./inter "rien" "cette phrase ne cache rien" | cat -e 21 | rien$ 22 | $>./inter | cat -e 23 | $ 24 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/inter/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : inter 2 | Expected files : inter.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes two strings and displays, without doubles, the 7 | characters that appear in both strings, in the order they appear in the first 8 | one. 9 | 10 | The display will be followed by a \n. 11 | 12 | If the number of arguments is not 2, the program displays \n. 13 | 14 | Examples: 15 | 16 | $>./inter "padinton" "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e 17 | padinto$ 18 | $>./inter ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e 19 | df6ewg4$ 20 | $>./inter "rien" "cette phrase ne cache rien" | cat -e 21 | rien$ 22 | $>./inter | cat -e 23 | $ 24 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/inter/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : inter 2 | Expected files : inter.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes two strings and displays, without doubles, the 7 | characters that appear in both strings, in the order they appear in the first 8 | one. 9 | 10 | The display will be followed by a \n. 11 | 12 | If the number of arguments is not 2, the program displays \n. 13 | 14 | Examples: 15 | 16 | $>./inter "padinton" "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e 17 | padinto$ 18 | $>./inter ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e 19 | df6ewg4$ 20 | $>./inter "rien" "cette phrase ne cache rien" | cat -e 21 | rien$ 22 | $>./inter | cat -e 23 | $ 24 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/need_correction/ft_list_foreach/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_list_foreach 2 | Expected files : ft_list_foreach.c 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a list and a function pointer, and applies this 7 | function to each element of the list. 8 | 9 | It must be declared as follows: 10 | 11 | void ft_list_foreach(t_list *begin_list, void (*f)(void *)); 12 | 13 | The function pointed to by f will be used as follows: 14 | 15 | (*f)(list_ptr->data); 16 | 17 | You must use the following structure, and turn it in your file ft_list_foreach.c : 18 | 19 | typedef struct s_list 20 | { 21 | struct s_list *next; 22 | void *data; 23 | } t_list; 24 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/2/ft_list_foreach/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_list_foreach 2 | Expected files : ft_list_foreach.c, ft_list.h 3 | Allowed functions: 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that takes a list and a function pointer, and applies this 7 | function to each element of the list. 8 | 9 | It must be declared as follows: 10 | 11 | void ft_list_foreach(t_list *begin_list, void (*f)(void *)); 12 | 13 | The function pointed to by f will be used as follows: 14 | 15 | (*f)(list_ptr->data); 16 | 17 | You must use the following structure, and turn it in as a file called 18 | ft_list.h: 19 | 20 | typedef struct s_list 21 | { 22 | struct s_list *next; 23 | void *data; 24 | } t_list; 25 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/add_prime_sum/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='add_prime_sum.c' 2 | ASSIGN='add_prime_sum' 3 | 4 | bash .system/auto_correc_program.sh $FILE $ASSIGN 5 | if [ -e .system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_program.sh $FILE $ASSIGN "5" 11 | if [ -e .system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | bash .system/auto_correc_program.sh $FILE $ASSIGN "Too" "Many" "Arguments" 17 | if [ -e .system/grading/traceback ];then 18 | mv .system/grading/traceback . 19 | exit 1 20 | fi 21 | 22 | bash .system/auto_correc_program.sh $FILE $ASSIGN "7" 23 | if [ -e .system/grading/traceback ];then 24 | mv .system/grading/traceback . 25 | exit 1 26 | fi 27 | 28 | touch .system/grading/passed; 29 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/camel_to_snake/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : camel_to_snake 2 | Expected files : camel_to_snake.c 3 | Allowed functions: malloc, free, realloc, write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a single string in lowerCamelCase format 7 | and converts it into a string in snake_case format. 8 | 9 | A lowerCamelCase string is a string where each word begins with a capital letter 10 | except for the first one. 11 | 12 | A snake_case string is a string where each word is in lower case, separated by 13 | an underscore "_". 14 | 15 | Examples: 16 | $>./camel_to_snake "hereIsACamelCaseWord" 17 | here_is_a_camel_case_word 18 | $>./camel_to_snake "helloWorld" | cat -e 19 | hello_world$ 20 | $>./camel_to_snake | cat -e 21 | $ 22 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/snake_to_camel/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : snake_to_camel 2 | Expected files : snake_to_camel.c 3 | Allowed functions: malloc, free, realloc, write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a single string in snake_case format 7 | and converts it into a string in lowerCamelCase format. 8 | 9 | A snake_case string is a string where each word is in lower case, separated by 10 | an underscore "_". 11 | 12 | A lowerCamelCase string is a string where each word begins with a capital letter 13 | except for the first one. 14 | 15 | Examples: 16 | $>./snake_to_camel "here_is_a_snake_case_word" 17 | hereIsASnakeCaseWord 18 | $>./snake_to_camel "hello_world" | cat -e 19 | helloWorld$ 20 | $>./snake_to_camel | cat -e 21 | $ 22 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_range/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_range 2 | Expected files : ft_range.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | int *ft_range(int start, int end); 9 | 10 | It must allocate (with malloc()) an array of integers, fill it with consecutive 11 | values that begin at start and end at end (Including start and end !), then 12 | return a pointer to the first value of the array. 13 | 14 | Examples: 15 | 16 | - With (1, 3) you will return an array containing 1, 2 and 3. 17 | - With (-1, 2) you will return an array containing -1, 0, 1 and 2. 18 | - With (0, 0) you will return an array containing 0. 19 | - With (0, -3) you will return an array containing 0, -1, -2 and -3. 20 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/flood_fill/flood_fill.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | 4 | typedef struct s_point { 5 | int x; // x : Width | x-axis 6 | int y; // y : Height | y-axis 7 | } t_point; 8 | 9 | void fill(char **tab, t_point size, t_point cur, char to_fill) 10 | { 11 | if (cur.y < 0 || cur.y >= size.y || cur.x < 0 || cur.x >= size.x 12 | || tab[cur.y][cur.x] != to_fill) 13 | return; 14 | 15 | tab[cur.y][cur.x] = 'F'; 16 | fill(tab, size, (t_point){cur.x - 1, cur.y}, to_fill); 17 | fill(tab, size, (t_point){cur.x + 1, cur.y}, to_fill); 18 | fill(tab, size, (t_point){cur.x, cur.y - 1}, to_fill); 19 | fill(tab, size, (t_point){cur.x, cur.y + 1}, to_fill); 20 | } 21 | 22 | void flood_fill(char **tab, t_point size, t_point begin) 23 | { 24 | fill(tab, size, begin, tab[begin.y][begin.x]); 25 | } 26 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/6/alpha_mirror/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : alpha_mirror 2 | Expected files : alpha_mirror.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program called alpha_mirror that takes a string and displays this string 7 | after replacing each alphabetical character by the opposite alphabetical 8 | character, followed by a newline. 9 | 10 | 'a' becomes 'z', 'Z' becomes 'A' 11 | 'd' becomes 'w', 'M' becomes 'N' 12 | 13 | and so on. 14 | 15 | Case is not changed. 16 | 17 | If the number of arguments is not 1, display only a newline. 18 | 19 | Examples: 20 | 21 | $>./alpha_mirror "abc" 22 | zyx 23 | $>./alpha_mirror "My horse is Amazing." | cat -e 24 | Nb slihv rh Znzarmt.$ 25 | $>./alpha_mirror | cat -e 26 | $ 27 | $> 28 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/1/alpha_mirror/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : alpha_mirror 2 | Expected files : alpha_mirror.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program called alpha_mirror that takes a string and displays this string 7 | after replacing each alphabetical character by the opposite alphabetical 8 | character, followed by a newline. 9 | 10 | 'a' becomes 'z', 'Z' becomes 'A' 11 | 'd' becomes 'w', 'M' becomes 'N' 12 | 13 | and so on. 14 | 15 | Case is not changed. 16 | 17 | If the number of arguments is not 1, display only a newline. 18 | 19 | Examples: 20 | 21 | $>./alpha_mirror "abc" 22 | zyx 23 | $>./alpha_mirror "My horse is Amazing." | cat -e 24 | Nb slihv rh Znzarmt.$ 25 | $>./alpha_mirror | cat -e 26 | $ 27 | $> 28 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/2/ft_rrange/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_rrange 2 | Expected files : ft_rrange.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | int *ft_rrange(int start, int end); 9 | 10 | It must allocate (with malloc()) an array of integers, fill it with consecutive 11 | values that begin at end and end at start (Including start and end !), then 12 | return a pointer to the first value of the array. 13 | 14 | Examples: 15 | 16 | - With (1, 3) you will return an array containing 3, 2 and 1 17 | - With (-1, 2) you will return an array containing 2, 1, 0 and -1. 18 | - With (0, 0) you will return an array containing 0. 19 | - With (0, -3) you will return an array containing -3, -2, -1 and 0. 20 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/3/ft_range/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_range 2 | Expected files : ft_range.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | int *ft_range(int start, int end); 9 | 10 | It must allocate (with malloc()) an array of integers, fill it with consecutive 11 | values that begin at start and end at end (Including start and end !), then 12 | return a pointer to the first value of the array. 13 | 14 | Examples: 15 | 16 | - With (1, 3) you will return an array containing 1, 2 and 3. 17 | - With (-1, 2) you will return an array containing -1, 0, 1 and 2. 18 | - With (0, 0) you will return an array containing 0. 19 | - With (0, -3) you will return an array containing 0, -1, -2 and -3. 20 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/0/ft_rrange/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_rrange 2 | Expected files : ft_rrange.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | int *ft_rrange(int start, int end); 9 | 10 | It must allocate (with malloc()) an array of integers, fill it with consecutive 11 | values that begin at end and end at start (Including start and end !), then 12 | return a pointer to the first value of the array. 13 | 14 | Examples: 15 | 16 | - With (1, 3) you will return an array containing 3, 2 and 1 17 | - With (-1, 2) you will return an array containing 2, 1, 0 and -1. 18 | - With (0, 0) you will return an array containing 0. 19 | - With (0, -3) you will return an array containing -3, -2, -1 and 0. 20 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/1/ft_range/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_range 2 | Expected files : ft_range.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | int *ft_range(int start, int end); 9 | 10 | It must allocate (with malloc()) an array of integers, fill it with consecutive 11 | values that begin at start and end at end (Including start and end !), then 12 | return a pointer to the first value of the array. 13 | 14 | Examples: 15 | 16 | - With (1, 3) you will return an array containing 1, 2 and 3. 17 | - With (-1, 2) you will return an array containing -1, 0, 1 and 2. 18 | - With (0, 0) you will return an array containing 0. 19 | - With (0, -3) you will return an array containing 0, -1, -2 and -3. 20 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/alpha_mirror/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : alpha_mirror 2 | Expected files : alpha_mirror.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program called alpha_mirror that takes a string and displays this string 7 | after replacing each alphabetical character by the opposite alphabetical 8 | character, followed by a newline. 9 | 10 | 'a' becomes 'z', 'Z' becomes 'A' 11 | 'd' becomes 'w', 'M' becomes 'N' 12 | 13 | and so on. 14 | 15 | Case is not changed. 16 | 17 | If the number of arguments is not 1, display only a newline. 18 | 19 | Examples: 20 | 21 | $>./alpha_mirror "abc" 22 | zyx 23 | $>./alpha_mirror "My horse is Amazing." | cat -e 24 | Nb slihv rh Znzarmt.$ 25 | $>./alpha_mirror | cat -e 26 | $ 27 | $> 28 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_rrange/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_rrange 2 | Expected files : ft_rrange.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write the following function: 7 | 8 | int *ft_rrange(int start, int end); 9 | 10 | It must allocate (with malloc()) an array of integers, fill it with consecutive 11 | values that begin at end and end at start (Including start and end !), then 12 | return a pointer to the first value of the array. 13 | 14 | Examples: 15 | 16 | - With (1, 3) you will return an array containing 3, 2 and 1 17 | - With (-1, 2) you will return an array containing 2, 1, 0 and -1. 18 | - With (0, 0) you will return an array containing 0. 19 | - With (0, -3) you will return an array containing -3, -2, -1 and 0. 20 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/ft_itoa/ft_itoa.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | #include 4 | 5 | int absolute_value(int nbr) 6 | { 7 | if (nbr < 0) 8 | return (-nbr); 9 | return (nbr); 10 | } 11 | 12 | int get_len(int nbr) 13 | { 14 | int len = 0; 15 | if (nbr <= 0) 16 | ++len; 17 | while (nbr != 0) 18 | { 19 | ++len; 20 | nbr = nbr / 10; 21 | } 22 | return (len); 23 | } 24 | 25 | char *ft_itoa(int nbr) 26 | { 27 | char *result; 28 | int len; 29 | 30 | len = get_len(nbr); 31 | result = malloc(sizeof(char) * (len + 1)); 32 | result[len] = '\0'; 33 | 34 | if (nbr < 0) 35 | result[0] = '-'; 36 | else if (nbr == 0) 37 | result[0] = '0'; 38 | 39 | while (nbr != 0) 40 | { 41 | --len; 42 | result[len] = absolute_value(nbr % 10) + '0'; 43 | nbr = nbr / 10; 44 | } 45 | return (result); 46 | } 47 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/last_word/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : last_word 2 | Expected files : last_word.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays its last word followed by a \n. 7 | 8 | A word is a section of string delimited by spaces/tabs or by the start/end of 9 | the string. 10 | 11 | If the number of parameters is not 1, or there are no words, display a newline. 12 | 13 | Example: 14 | 15 | $> ./last_word "FOR PONY" | cat -e 16 | PONY$ 17 | $> ./last_word "this ... is sparta, then again, maybe not" | cat -e 18 | not$ 19 | $> ./last_word " " | cat -e 20 | $ 21 | $> ./last_word "a" "b" | cat -e 22 | $ 23 | $> ./last_word " lorem,ipsum " | cat -e 24 | lorem,ipsum$ 25 | $> 26 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/5/last_word/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : last_word 2 | Expected files : last_word.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays its last word followed by a \n. 7 | 8 | A word is a section of string delimited by spaces/tabs or by the start/end of 9 | the string. 10 | 11 | If the number of parameters is not 1, or there are no words, display a newline. 12 | 13 | Example: 14 | 15 | $> ./last_word "FOR PONY" | cat -e 16 | PONY$ 17 | $> ./last_word "this ... is sparta, then again, maybe not" | cat -e 18 | not$ 19 | $> ./last_word " " | cat -e 20 | $ 21 | $> ./last_word "a" "b" | cat -e 22 | $ 23 | $> ./last_word " lorem,ipsum " | cat -e 24 | lorem,ipsum$ 25 | $> 26 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/last_word/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : last_word 2 | Expected files : last_word.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays its last word followed by a \n. 7 | 8 | A word is a section of string delimited by spaces/tabs or by the start/end of 9 | the string. 10 | 11 | If the number of parameters is not 1, or there are no words, display a newline. 12 | 13 | Example: 14 | 15 | $> ./last_word "FOR PONY" | cat -e 16 | PONY$ 17 | $> ./last_word "this ... is sparta, then again, maybe not" | cat -e 18 | not$ 19 | $> ./last_word " " | cat -e 20 | $ 21 | $> ./last_word "a" "b" | cat -e 22 | $ 23 | $> ./last_word " lorem,ipsum " | cat -e 24 | lorem,ipsum$ 25 | $> 26 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/2/ft_list_remove_if/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_list_remove_if 2 | Expected files : ft_list_remove_if.c 3 | Allowed functions: free 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function called ft_list_remove_if that removes from the 7 | passed list any element the data of which is "equal" to the reference data. 8 | 9 | It will be declared as follows : 10 | 11 | void ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)()); 12 | 13 | cmp takes two void* and returns 0 when both parameters are equal. 14 | 15 | You have to use the ft_list.h file, which will contain: 16 | 17 | $>cat ft_list.h 18 | typedef struct s_list 19 | { 20 | struct s_list *next; 21 | void *data; 22 | } t_list; 23 | $> 24 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/3/lcm/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Write a function who takes two unsigned int as parameters and returns the 2 | computed LCM of those parameters. 3 | 4 | LCM (Lowest Common Multiple) of two non-zero integers is the smallest postive 5 | integer divisible by the both integers. 6 | 7 | A LCM can be calculated in two ways: 8 | 9 | - You can calculate every multiples of each integers until you have a common 10 | multiple other than 0 11 | 12 | - You can use the HCF (Highest Common Factor) of these two integers and 13 | calculate as follows: 14 | 15 | LCM(x, y) = | x * y | / HCF(x, y) 16 | 17 | | x * y | means "Absolute value of the product of x by y" 18 | 19 | If at least one integer is null, LCM is equal to 0. 20 | 21 | Your function must be prototyped as follows: 22 | 23 | unsigned int lcm(unsigned int a, unsigned int b); -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/1/lcm/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Write a function who takes two unsigned int as parameters and returns the 2 | computed LCM of those parameters. 3 | 4 | LCM (Lowest Common Multiple) of two non-zero integers is the smallest postive 5 | integer divisible by the both integers. 6 | 7 | A LCM can be calculated in two ways: 8 | 9 | - You can calculate every multiples of each integers until you have a common 10 | multiple other than 0 11 | 12 | - You can use the HCF (Highest Common Factor) of these two integers and 13 | calculate as follows: 14 | 15 | LCM(x, y) = | x * y | / HCF(x, y) 16 | 17 | | x * y | means "Absolute value of the product of x by y" 18 | 19 | If at least one integer is null, LCM is equal to 0. 20 | 21 | Your function must be prototyped as follows: 22 | 23 | unsigned int lcm(unsigned int a, unsigned int b); -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/7/rot_13/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : rot_13 2 | Expected files : rot_13.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays it, replacing each of its 7 | letters by the letter 13 spaces ahead in alphabetical order. 8 | 9 | 'z' becomes 'm' and 'Z' becomes 'M'. Case remains unaffected. 10 | 11 | The output will be followed by a newline. 12 | 13 | If the number of arguments is not 1, the program displays a newline. 14 | 15 | Example: 16 | 17 | $>./rot_13 "abc" 18 | nop 19 | $>./rot_13 "My horse is Amazing." | cat -e 20 | Zl ubefr vf Nznmvat.$ 21 | $>./rot_13 "AkjhZ zLKIJz , 23y " | cat -e 22 | NxwuM mYXVWm , 23l $ 23 | $>./rot_13 | cat -e 24 | $ 25 | $> 26 | $>./rot_13 "" | cat -e 27 | $ 28 | $> 29 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/3/rot_13/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : rot_13 2 | Expected files : rot_13.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays it, replacing each of its 7 | letters by the letter 13 spaces ahead in alphabetical order. 8 | 9 | 'z' becomes 'm' and 'Z' becomes 'M'. Case remains unaffected. 10 | 11 | The output will be followed by a newline. 12 | 13 | If the number of arguments is not 1, the program displays a newline. 14 | 15 | Example: 16 | 17 | $>./rot_13 "abc" 18 | nop 19 | $>./rot_13 "My horse is Amazing." | cat -e 20 | Zl ubefr vf Nznmvat.$ 21 | $>./rot_13 "AkjhZ zLKIJz , 23y " | cat -e 22 | NxwuM mYXVWm , 23l $ 23 | $>./rot_13 | cat -e 24 | $ 25 | $> 26 | $>./rot_13 "" | cat -e 27 | $ 28 | $> 29 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/rot_13/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : rot_13 2 | Expected files : rot_13.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays it, replacing each of its 7 | letters by the letter 13 spaces ahead in alphabetical order. 8 | 9 | 'z' becomes 'm' and 'Z' becomes 'M'. Case remains unaffected. 10 | 11 | The output will be followed by a newline. 12 | 13 | If the number of arguments is not 1, the program displays a newline. 14 | 15 | Example: 16 | 17 | $>./rot_13 "abc" 18 | nop 19 | $>./rot_13 "My horse is Amazing." | cat -e 20 | Zl ubefr vf Nznmvat.$ 21 | $>./rot_13 "AkjhZ zLKIJz , 23y " | cat -e 22 | NxwuM mYXVWm , 23l $ 23 | $>./rot_13 | cat -e 24 | $ 25 | $> 26 | $>./rot_13 "" | cat -e 27 | $ 28 | $> 29 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/need_correction/ft_list_remove_if/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_list_remove_if 2 | Expected files : ft_list_remove_if.c 3 | Allowed functions: free 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function called ft_list_remove_if that removes from the 7 | passed list any element the data of which is "equal" to the reference data. 8 | 9 | It will be declared as follows : 10 | 11 | void ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)()); 12 | 13 | cmp takes two void* and returns 0 when both parameters are equal. 14 | 15 | You have to use the ft_list.h file, which will contain: 16 | 17 | $>cat ft_list.h 18 | typedef struct s_list 19 | { 20 | struct s_list *next; 21 | void *data; 22 | } t_list; 23 | $> 24 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/fprime/fprime.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.01 2 | 3 | #include 4 | #include 5 | 6 | int is_prime(int n) 7 | { 8 | int i = 2; 9 | 10 | while (i < n) 11 | { 12 | if (n % i == 0) 13 | return (0); 14 | ++i; 15 | } 16 | return (1); 17 | } 18 | 19 | void fprime(char *str) 20 | { 21 | int n = atoi(str); 22 | int factor = 2; 23 | int first = 1; 24 | 25 | if (n == 1) 26 | printf("1"); 27 | 28 | while (factor <= n) 29 | { 30 | if (n % factor == 0 && is_prime(factor)) 31 | { 32 | if (first == 1) 33 | printf("%d", factor); 34 | else 35 | printf("*%d", factor); 36 | first = 0; 37 | n = n / factor; 38 | } 39 | else 40 | ++factor; 41 | } 42 | } 43 | 44 | int main(int argc, char **argv) 45 | { 46 | if (argc == 2) 47 | fprime(argv[1]); 48 | 49 | printf("\n"); 50 | return (0); 51 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/first_word/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : first_word 2 | Expected files : first_word.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays its first word, followed by a 7 | newline. 8 | 9 | A word is a section of string delimited by spaces/tabs or by the start/end of 10 | the string. 11 | 12 | If the number of parameters is not 1, or if there are no words, simply display 13 | a newline. 14 | 15 | Examples: 16 | 17 | $> ./first_word "FOR PONY" | cat -e 18 | FOR$ 19 | $> ./first_word "this ... is sparta, then again, maybe not" | cat -e 20 | this$ 21 | $> ./first_word " " | cat -e 22 | $ 23 | $> ./first_word "a" "b" | cat -e 24 | $ 25 | $> ./first_word " lorem,ipsum " | cat -e 26 | lorem,ipsum$ 27 | $> 28 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/6/first_word/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : first_word 2 | Expected files : first_word.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays its first word, followed by a 7 | newline. 8 | 9 | A word is a section of string delimited by spaces/tabs or by the start/end of 10 | the string. 11 | 12 | If the number of parameters is not 1, or if there are no words, simply display 13 | a newline. 14 | 15 | Examples: 16 | 17 | $> ./first_word "FOR PONY" | cat -e 18 | FOR$ 19 | $> ./first_word "this ... is sparta, then again, maybe not" | cat -e 20 | this$ 21 | $> ./first_word " " | cat -e 22 | $ 23 | $> ./first_word "a" "b" | cat -e 24 | $ 25 | $> ./first_word " lorem,ipsum " | cat -e 26 | lorem,ipsum$ 27 | $> 28 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/2/first_word/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : first_word 2 | Expected files : first_word.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays its first word, followed by a 7 | newline. 8 | 9 | A word is a section of string delimited by spaces/tabs or by the start/end of 10 | the string. 11 | 12 | If the number of parameters is not 1, or if there are no words, simply display 13 | a newline. 14 | 15 | Examples: 16 | 17 | $> ./first_word "FOR PONY" | cat -e 18 | FOR$ 19 | $> ./first_word "this ... is sparta, then again, maybe not" | cat -e 20 | this$ 21 | $> ./first_word " " | cat -e 22 | $ 23 | $> ./first_word "a" "b" | cat -e 24 | $ 25 | $> ./first_word " lorem,ipsum " | cat -e 26 | lorem,ipsum$ 27 | $> 28 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/ft_atoi_base/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_atoi_base 2 | Expected files : ft_atoi_base.c 3 | Allowed functions: None 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that converts the string argument str (base N <= 16) 7 | to an integer (base 10) and returns it. 8 | 9 | The characters recognized in the input are: 0123456789abcdef 10 | Those are, of course, to be trimmed according to the requested base. For 11 | example, base 4 recognizes "0123" and base 16 recognizes "0123456789abcdef". 12 | 13 | Uppercase letters must also be recognized: "12fdb3" is the same as "12FDB3". 14 | 15 | Minus signs ('-') are interpreted only if they are the first character of the 16 | string. 17 | 18 | Your function must be declared as follows: 19 | 20 | int ft_atoi_base(const char *str, int str_base); 21 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/rev_wstr/tester.sh: -------------------------------------------------------------------------------- 1 | FILE='rev_wstr.c' 2 | ASSIGN='rev_wstr' 3 | 4 | bash .system/auto_correc_program.sh $FILE $ASSIGN "order in us put" 5 | if [ -e ./.system/grading/traceback ];then 6 | mv .system/grading/traceback . 7 | exit 1 8 | fi 9 | 10 | bash .system/auto_correc_program.sh $FILE $ASSIGN "done! well it, did You" 11 | if [ -e ./.system/grading/traceback ];then 12 | mv .system/grading/traceback . 13 | exit 1 14 | fi 15 | 16 | bash .system/auto_correc_program.sh $FILE $ASSIGN "You hate people! But I love gatherings. Isn't it ironic?" 17 | if [ -e ./.system/grading/traceback ];then 18 | mv .system/grading/traceback . 19 | exit 1 20 | fi 21 | 22 | bash .system/auto_correc_program.sh $FILE $ASSIGN "abcdefghijklm" 23 | if [ -e ./.system/grading/traceback ];then 24 | mv .system/grading/traceback . 25 | exit 1 26 | fi 27 | 28 | touch .system/grading/passed; 29 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/3/ft_atoi_base/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_atoi_base 2 | Expected files : ft_atoi_base.c 3 | Allowed functions: None 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that converts the string argument str (base N <= 16) 7 | to an integer (base 10) and returns it. 8 | 9 | The characters recognized in the input are: 0123456789abcdef 10 | Those are, of course, to be trimmed according to the requested base. For 11 | example, base 4 recognizes "0123" and base 16 recognizes "0123456789abcdef". 12 | 13 | Uppercase letters must also be recognized: "12fdb3" is the same as "12FDB3". 14 | 15 | Minus signs ('-') are interpreted only if they are the first character of the 16 | string. 17 | 18 | Your function must be declared as follows: 19 | 20 | int ft_atoi_base(const char *str, int str_base); 21 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/1/ft_atoi_base/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_atoi_base 2 | Expected files : ft_atoi_base.c 3 | Allowed functions: None 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that converts the string argument str (base N <= 16) 7 | to an integer (base 10) and returns it. 8 | 9 | The characters recognized in the input are: 0123456789abcdef 10 | Those are, of course, to be trimmed according to the requested base. For 11 | example, base 4 recognizes "0123" and base 16 recognizes "0123456789abcdef". 12 | 13 | Uppercase letters must also be recognized: "12fdb3" is the same as "12FDB3". 14 | 15 | Minus signs ('-') are interpreted only if they are the first character of the 16 | string. 17 | 18 | Your function must be declared as follows: 19 | 20 | int ft_atoi_base(const char *str, int str_base); 21 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/1/union/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : union 2 | Expected files : union.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes two strings and displays, without doubles, the 7 | characters that appear in either one of the strings. 8 | 9 | The display will be in the order characters appear in the command line, and 10 | will be followed by a \n. 11 | 12 | If the number of arguments is not 2, the program displays \n. 13 | 14 | Example: 15 | 16 | $>./union zpadinton "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e 17 | zpadintoqefwjy$ 18 | $>./union ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e 19 | df6vewg4thras$ 20 | $>./union "rien" "cette phrase ne cache rien" | cat -e 21 | rienct phas$ 22 | $>./union | cat -e 23 | $ 24 | $> 25 | $>./union "rien" | cat -e 26 | $ 27 | $> 28 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/rotone/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : rotone 2 | Expected files : rotone.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays it, replacing each of its 7 | letters by the next one in alphabetical order. 8 | 9 | 'z' becomes 'a' and 'Z' becomes 'A'. Case remains unaffected. 10 | 11 | The output will be followed by a \n. 12 | 13 | If the number of arguments is not 1, the program displays \n. 14 | 15 | Example: 16 | 17 | $>./rotone "abc" 18 | bcd 19 | $>./rotone "Les stagiaires du staff ne sentent pas toujours tres bon." | cat -e 20 | Mft tubhjbjsft ev tubgg of tfoufou qbt upvkpvst usft cpo.$ 21 | $>./rotone "AkjhZ zLKIJz , 23y " | cat -e 22 | BlkiA aMLJKa , 23z $ 23 | $>./rotone | cat -e 24 | $ 25 | $> 26 | $>./rotone "" | cat -e 27 | $ 28 | $> 29 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/epur_str/epur_str.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int skip_whitespace(char *str, int i) 4 | { 5 | while (str[i] == ' ' || str[i] == '\t') 6 | ++i; 7 | return (i); 8 | } 9 | 10 | int ft_wordlen(char *str) 11 | { 12 | int i = 0; 13 | 14 | while (str[i] != '\0' && str[i] != ' ' && str[i] != '\t') 15 | ++i; 16 | return (i); 17 | } 18 | 19 | void epur_str(char *str) 20 | { 21 | int i = 0; 22 | int first_word = 1; 23 | int word_len; 24 | 25 | i = skip_whitespace(str, i); 26 | while (str[i] != '\0') 27 | { 28 | if (first_word == 0) 29 | write(1, " ", 1); 30 | word_len = ft_wordlen(str + i); 31 | write(1, str + i, word_len); 32 | i = i + word_len; 33 | first_word = 0; 34 | i = skip_whitespace(str, i); 35 | } 36 | } 37 | 38 | int main(int argc, char **argv) 39 | { 40 | if (argc == 2) 41 | epur_str(argv[1]); 42 | write(1, "\n", 1); 43 | return (0); 44 | } -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/tab_mult/tab_mult.c: -------------------------------------------------------------------------------- 1 | // Passed Moulinette 2019.09.02 2 | 3 | #include 4 | 5 | int ft_atoi(char *str) 6 | { 7 | int n = 0; 8 | 9 | while (*str >= '0' && *str <= '9') 10 | { 11 | n = n * 10; 12 | n = n + *str - '0'; 13 | ++str; 14 | } 15 | return (n); 16 | } 17 | 18 | void ft_putnbr(int n) 19 | { 20 | if (n >= 10) 21 | ft_putnbr(n / 10); 22 | 23 | char c = (n % 10) + '0'; 24 | write(1, &c, 1); 25 | } 26 | 27 | void tab_mult(char *str) 28 | { 29 | int n; 30 | int i = 1; 31 | 32 | n = ft_atoi(str); 33 | while (i <= 9) 34 | { 35 | ft_putnbr(i); 36 | write(1, " x ", 3); 37 | ft_putnbr(n); 38 | write(1, " = ", 3); 39 | ft_putnbr(i * n); 40 | write(1, "\n", 1); 41 | ++i; 42 | } 43 | } 44 | 45 | int main(int argc, char **argv) 46 | { 47 | if (argc == 2) 48 | tab_mult(argv[1]); 49 | else 50 | write(1, "\n", 1); 51 | return (0); 52 | } -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/7/rotone/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : rotone 2 | Expected files : rotone.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays it, replacing each of its 7 | letters by the next one in alphabetical order. 8 | 9 | 'z' becomes 'a' and 'Z' becomes 'A'. Case remains unaffected. 10 | 11 | The output will be followed by a \n. 12 | 13 | If the number of arguments is not 1, the program displays \n. 14 | 15 | Example: 16 | 17 | $>./rotone "abc" 18 | bcd 19 | $>./rotone "Les stagiaires du staff ne sentent pas toujours tres bon." | cat -e 20 | Mft tubhjbjsft ev tubgg of tfoufou qbt upvkpvst usft cpo.$ 21 | $>./rotone "AkjhZ zLKIJz , 23y " | cat -e 22 | BlkiA aMLJKa , 23z $ 23 | $>./rotone | cat -e 24 | $ 25 | $> 26 | $>./rotone "" | cat -e 27 | $ 28 | $> 29 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/3/rotone/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : rotone 2 | Expected files : rotone.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes a string and displays it, replacing each of its 7 | letters by the next one in alphabetical order. 8 | 9 | 'z' becomes 'a' and 'Z' becomes 'A'. Case remains unaffected. 10 | 11 | The output will be followed by a \n. 12 | 13 | If the number of arguments is not 1, the program displays \n. 14 | 15 | Example: 16 | 17 | $>./rotone "abc" 18 | bcd 19 | $>./rotone "Les stagiaires du staff ne sentent pas toujours tres bon." | cat -e 20 | Mft tubhjbjsft ev tubgg of tfoufou qbt upvkpvst usft cpo.$ 21 | $>./rotone "AkjhZ zLKIJz , 23y " | cat -e 22 | BlkiA aMLJKa , 23z $ 23 | $>./rotone | cat -e 24 | $ 25 | $> 26 | $>./rotone "" | cat -e 27 | $ 28 | $> 29 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/5/union/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : union 2 | Expected files : union.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes two strings and displays, without doubles, the 7 | characters that appear in either one of the strings. 8 | 9 | The display will be in the order characters appear in the command line, and 10 | will be followed by a \n. 11 | 12 | If the number of arguments is not 2, the program displays \n. 13 | 14 | Example: 15 | 16 | $>./union zpadinton "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e 17 | zpadintoqefwjy$ 18 | $>./union ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e 19 | df6vewg4thras$ 20 | $>./union "rien" "cette phrase ne cache rien" | cat -e 21 | rienct phas$ 22 | $>./union | cat -e 23 | $ 24 | $> 25 | $>./union "rien" | cat -e 26 | $ 27 | $> 28 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/0/union/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : union 2 | Expected files : union.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that takes two strings and displays, without doubles, the 7 | characters that appear in either one of the strings. 8 | 9 | The display will be in the order characters appear in the command line, and 10 | will be followed by a \n. 11 | 12 | If the number of arguments is not 2, the program displays \n. 13 | 14 | Example: 15 | 16 | $>./union zpadinton "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e 17 | zpadintoqefwjy$ 18 | $>./union ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e 19 | df6vewg4thras$ 20 | $>./union "rien" "cette phrase ne cache rien" | cat -e 21 | rienct phas$ 22 | $>./union | cat -e 23 | $ 24 | $> 25 | $>./union "rien" | cat -e 26 | $ 27 | $> 28 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/2/tab_mult/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : tab_mult 2 | Expected files : tab_mult.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays a number's multiplication table. 7 | 8 | The parameter will always be a strictly positive number that fits in an int, 9 | and said number times 9 will also fit in an int. 10 | 11 | If there are no parameters, the program displays \n. 12 | 13 | Examples: 14 | 15 | $>./tab_mult 9 16 | 1 x 9 = 9 17 | 2 x 9 = 18 18 | 3 x 9 = 27 19 | 4 x 9 = 36 20 | 5 x 9 = 45 21 | 6 x 9 = 54 22 | 7 x 9 = 63 23 | 8 x 9 = 72 24 | 9 x 9 = 81 25 | $>./tab_mult 19 26 | 1 x 19 = 19 27 | 2 x 19 = 38 28 | 3 x 19 = 57 29 | 4 x 19 = 76 30 | 5 x 19 = 95 31 | 6 x 19 = 114 32 | 7 x 19 = 133 33 | 8 x 19 = 152 34 | 9 x 19 = 171 35 | $> 36 | $>./tab_mult | cat -e 37 | $ 38 | $> 39 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_03/3/tab_mult/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : tab_mult 2 | Expected files : tab_mult.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays a number's multiplication table. 7 | 8 | The parameter will always be a strictly positive number that fits in an int, 9 | and said number times 9 will also fit in an int. 10 | 11 | If there are no parameters, the program displays \n. 12 | 13 | Examples: 14 | 15 | $>./tab_mult 9 16 | 1 x 9 = 9 17 | 2 x 9 = 18 18 | 3 x 9 = 27 19 | 4 x 9 = 36 20 | 5 x 9 = 45 21 | 6 x 9 = 54 22 | 7 x 9 = 63 23 | 8 x 9 = 72 24 | 9 x 9 = 81 25 | $>./tab_mult 19 26 | 1 x 19 = 19 27 | 2 x 19 = 38 28 | 3 x 19 = 57 29 | 4 x 19 = 76 30 | 5 x 19 = 95 31 | 6 x 19 = 114 32 | 7 x 19 = 133 33 | 8 x 19 = 152 34 | 9 x 19 = 171 35 | $> 36 | $>./tab_mult | cat -e 37 | $ 38 | $> 39 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/1/tab_mult/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : tab_mult 2 | Expected files : tab_mult.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program that displays a number's multiplication table. 7 | 8 | The parameter will always be a strictly positive number that fits in an int, 9 | and said number times 9 will also fit in an int. 10 | 11 | If there are no parameters, the program displays \n. 12 | 13 | Examples: 14 | 15 | $>./tab_mult 9 16 | 1 x 9 = 9 17 | 2 x 9 = 18 18 | 3 x 9 = 27 19 | 4 x 9 = 36 20 | 5 x 9 = 45 21 | 6 x 9 = 54 22 | 7 x 9 = 63 23 | 8 x 9 = 72 24 | 9 x 9 = 81 25 | $>./tab_mult 19 26 | 1 x 19 = 19 27 | 2 x 19 = 38 28 | 3 x 19 = 57 29 | 4 x 19 = 76 30 | 5 x 19 = 95 31 | 6 x 19 = 114 32 | 7 x 19 = 133 33 | 8 x 19 = 152 34 | 9 x 19 = 171 35 | $> 36 | $>./tab_mult | cat -e 37 | $ 38 | $> 39 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/0/repeat_alpha/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : repeat_alpha 2 | Expected files : repeat_alpha.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program called repeat_alpha that takes a string and display it 7 | repeating each alphabetical character as many times as its alphabetical index, 8 | followed by a newline. 9 | 10 | 'a' becomes 'a', 'b' becomes 'bb', 'e' becomes 'eeeee', etc... 11 | 12 | Case remains unchanged. 13 | 14 | If the number of arguments is not 1, just display a newline. 15 | 16 | Examples: 17 | 18 | $>./repeat_alpha "abc" 19 | abbccc 20 | $>./repeat_alpha "Alex." | cat -e 21 | Alllllllllllleeeeexxxxxxxxxxxxxxxxxxxxxxxx.$ 22 | $>./repeat_alpha 'abacadaba 42!' | cat -e 23 | abbacccaddddabba 42!$ 24 | $>./repeat_alpha | cat -e 25 | $ 26 | $> 27 | $>./repeat_alpha "" | cat -e 28 | $ 29 | $> 30 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_01/5/repeat_alpha/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : repeat_alpha 2 | Expected files : repeat_alpha.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program called repeat_alpha that takes a string and display it 7 | repeating each alphabetical character as many times as its alphabetical index, 8 | followed by a newline. 9 | 10 | 'a' becomes 'a', 'b' becomes 'bb', 'e' becomes 'eeeee', etc... 11 | 12 | Case remains unchanged. 13 | 14 | If the number of arguments is not 1, just display a newline. 15 | 16 | Examples: 17 | 18 | $>./repeat_alpha "abc" 19 | abbccc 20 | $>./repeat_alpha "Alex." | cat -e 21 | Alllllllllllleeeeexxxxxxxxxxxxxxxxxxxxxxxx.$ 22 | $>./repeat_alpha 'abacadaba 42!' | cat -e 23 | abbacccaddddabba 42!$ 24 | $>./repeat_alpha | cat -e 25 | $ 26 | $> 27 | $>./repeat_alpha "" | cat -e 28 | $ 29 | $> 30 | -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_02/0/repeat_alpha/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : repeat_alpha 2 | Expected files : repeat_alpha.c 3 | Allowed functions: write 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a program called repeat_alpha that takes a string and display it 7 | repeating each alphabetical character as many times as its alphabetical index, 8 | followed by a newline. 9 | 10 | 'a' becomes 'a', 'b' becomes 'bb', 'e' becomes 'eeeee', etc... 11 | 12 | Case remains unchanged. 13 | 14 | If the number of arguments is not 1, just display a newline. 15 | 16 | Examples: 17 | 18 | $>./repeat_alpha "abc" 19 | abbccc 20 | $>./repeat_alpha "Alex." | cat -e 21 | Alllllllllllleeeeexxxxxxxxxxxxxxxxxxxxxxxx.$ 22 | $>./repeat_alpha 'abacadaba 42!' | cat -e 23 | abbacccaddddabba 42!$ 24 | $>./repeat_alpha | cat -e 25 | $ 26 | $> 27 | $>./repeat_alpha "" | cat -e 28 | $ 29 | $> 30 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_02/3/rev_wstr/rev_wstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_putchar(char c) 4 | { 5 | write(1, &c, 1); 6 | } 7 | 8 | int ft_strlen(char *str) 9 | { 10 | int i = 0; 11 | 12 | while (str[i]) 13 | i++; 14 | return (i); 15 | } 16 | 17 | int main(int ac, char *av[]) 18 | { 19 | char *tmp; 20 | char *rev; 21 | int len; 22 | 23 | if (ac == 2) 24 | { 25 | tmp = av[1]; 26 | len = ft_strlen(tmp); 27 | rev = NULL; 28 | len--; 29 | while (tmp[len]) 30 | { 31 | if (tmp[len - 1] == ' ') 32 | { 33 | rev = &tmp[len]; 34 | while (*rev && *rev != ' ') 35 | { 36 | ft_putchar(*rev); 37 | rev++; 38 | } 39 | ft_putchar(' '); 40 | } 41 | else if (len == 0) 42 | { 43 | rev = &tmp[len]; 44 | while (*rev && *rev != ' ') 45 | { 46 | ft_putchar(*rev); 47 | rev++; 48 | } 49 | } 50 | len--; 51 | } 52 | } 53 | ft_putchar('\n'); 54 | } 55 | -------------------------------------------------------------------------------- /.system/exercise.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | class exam; 5 | 6 | class exercise 7 | { 8 | public: 9 | exercise(void); 10 | exercise(int level, std::string ex_name); 11 | exercise(int level, std::string ex_name, int assign, time_t tbg); 12 | exercise(exercise const & src); 13 | ~exercise(void); 14 | 15 | exercise& operator=(exercise const & src); 16 | std::string get_name(void); 17 | int get_assignement(void); 18 | void reset_assignement(void); 19 | void up_assignement(void); 20 | void set_assignement(int assignement); 21 | void up_lvl(void); 22 | double grade_time(void); 23 | void set_time_bef_grade(time_t time_bef_grade); 24 | int get_lvl(void); 25 | time_t time_bef_grade; 26 | private : 27 | int assignement; 28 | std::string name; 29 | int level_ex; 30 | }; -------------------------------------------------------------------------------- /.subjects/PISCINE_PART/exam_04/2/ft_itoa_base/attachment/subject.en.txt: -------------------------------------------------------------------------------- 1 | Assignment name : ft_itoa_base 2 | Expected files : ft_itoa_base.c 3 | Allowed functions: malloc 4 | -------------------------------------------------------------------------------- 5 | 6 | Write a function that converts an integer value to a null-terminated string 7 | using the specified base and stores the result in a char array that you must 8 | allocate. 9 | 10 | The base is expressed as an integer, from 2 to 16. The characters comprising 11 | the base are the digits from 0 to 9, followed by uppercase letter from A to F. 12 | 13 | For example, base 4 would be "0123" and base 16 "0123456789ABCDEF". 14 | 15 | If base is 10 and value is negative, the resulting string is preceded with a 16 | minus sign (-). With any other base, value is always considered unsigned. 17 | 18 | Your function must be declared as follows: 19 | 20 | char *ft_itoa_base(int value, int base); 21 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/Warlock.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "ASpell.hpp" 5 | #include "ATarget.hpp" 6 | #include "SpellBook.hpp" 7 | 8 | class Warlock 9 | { 10 | private: 11 | std::string name; 12 | std::string title; 13 | 14 | Warlock(); 15 | Warlock(Warlock const &other); 16 | Warlock &operator=(Warlock const &other); 17 | 18 | SpellBook book; 19 | public: 20 | Warlock(std::string const &name, std::string const &title); 21 | ~Warlock(); 22 | 23 | std::string const &getName() const; 24 | std::string const &getTitle() const; 25 | 26 | void setTitle(std::string const &title); 27 | 28 | void introduce() const; 29 | 30 | void learnSpell(ASpell *aspell_ptr); 31 | void forgetSpell(std::string name); 32 | void launchSpell(std::string name, ATarget const &atarget_ref); 33 | }; -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/2/cpp_module02/main.cpp: -------------------------------------------------------------------------------- 1 | #include "Warlock.hpp" 2 | #include "Fwoosh.hpp" 3 | #include "Dummy.hpp" 4 | #include "BrickWall.hpp" 5 | #include "Polymorph.hpp" 6 | #include "TargetGenerator.hpp" 7 | #include "Fireball.hpp" 8 | #include "ATarget.hpp" 9 | #include "ASpell.hpp" 10 | #include "SpellBook.hpp" 11 | 12 | int main() 13 | { 14 | Warlock richard("Richard", "foo"); 15 | richard.setTitle("Hello, I'm Richard the Warlock!"); 16 | BrickWall model1; 17 | 18 | Polymorph* polymorph = new Polymorph(); 19 | TargetGenerator tarGen; 20 | 21 | tarGen.learnTargetType(&model1); 22 | richard.learnSpell(polymorph); 23 | 24 | Fireball* fireball = new Fireball(); 25 | 26 | richard.learnSpell(fireball); 27 | 28 | ATarget* wall = tarGen.createTarget("Inconspicuous Red-brick Wall"); 29 | 30 | richard.introduce(); 31 | richard.launchSpell("Polymorph", *wall); 32 | richard.launchSpell("Fireball", *wall); 33 | } 34 | -------------------------------------------------------------------------------- /.subjects/STUD_PART/exam_05/1/cpp_module01/Warlock.hpp: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include "ASpell.hpp" 6 | #include "ATarget.hpp" 7 | #include 8 | 9 | class Warlock 10 | { 11 | private: 12 | std::string name; 13 | std::string title; 14 | 15 | Warlock(); 16 | Warlock(Warlock const &other); 17 | Warlock &operator=(Warlock const &other); 18 | 19 | std::map arr; 20 | public: 21 | Warlock(std::string const &name, std::string const &title); 22 | ~Warlock(); 23 | 24 | std::string const &getName() const; 25 | std::string const &getTitle() const; 26 | 27 | void setTitle(std::string const &title); 28 | 29 | void introduce() const; 30 | 31 | void learnSpell(ASpell *aspell_ptr); 32 | void forgetSpell(std::string name); 33 | void launchSpell(std::string name, ATarget const &atarget_ref); 34 | }; --------------------------------------------------------------------------------