init
This commit is contained in:
8
exam-basedir03/subjects/aff_z/examples.txt
Normal file
8
exam-basedir03/subjects/aff_z/examples.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
$> ./aff_z "abc" | cat -e
|
||||
z$
|
||||
$> ./aff_z "dubO a POIL" | cat -e
|
||||
z$
|
||||
$> ./aff_z "zaz sent le poney" | cat -e
|
||||
z$
|
||||
$> ./aff_z | cat -e
|
||||
z$
|
21
exam-basedir03/subjects/aff_z/subject.en.txt
Normal file
21
exam-basedir03/subjects/aff_z/subject.en.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
Assignment name : aff_z
|
||||
Expected files : aff_z.c
|
||||
Allowed functions: write
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Write a program that takes a string, and displays the first 'z'
|
||||
character it encounters in it, followed by a newline. If there are no
|
||||
'z' characters in the string, the program writes 'z' followed
|
||||
by a newline. If the number of parameters is not 1, the program displays
|
||||
'z' followed by a newline.
|
||||
|
||||
Example:
|
||||
|
||||
$> ./aff_z "abc" | cat -e
|
||||
z$
|
||||
$> ./aff_z "RaInB0w d4Sh!" | cat -e
|
||||
z$
|
||||
$> ./aff_z "ThE C4k3 Is a L|3" | cat -e
|
||||
z$
|
||||
$> ./aff_z | cat -e
|
||||
z$
|
22
exam-basedir03/subjects/aff_z/subject.fr.txt
Normal file
22
exam-basedir03/subjects/aff_z/subject.fr.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
Assignment name : aff_z
|
||||
Expected files : aff_z.c
|
||||
Allowed functions: write
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Écrire un programme qui prend en paramètre une chaîne de caractères, et qui
|
||||
affiche sur la sortie standard le premier caractère 'z' rencontré dans
|
||||
cette chaîne, suivi de '\n'. Si aucun 'z'
|
||||
n'est rencontré dans la chaîne, le programme affiche 'z' suivi de
|
||||
'\n'. Si le nombre de paramètres est différent de 1, le
|
||||
programme affiche 'z' suivi de '\n'.
|
||||
|
||||
Exemple:
|
||||
|
||||
$> ./aff_z "abc" | cat -e
|
||||
z$
|
||||
$> ./aff_z "dubO a POIL" | cat -e
|
||||
z$
|
||||
$> ./aff_z "zaz sent le poney" | cat -e
|
||||
z$
|
||||
$> ./aff_z | cat -e
|
||||
z$
|
19
exam-basedir03/subjects/aff_z/subject.ro.txt
Normal file
19
exam-basedir03/subjects/aff_z/subject.ro.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
Exercitiu : aff_z
|
||||
Fisiere de iesire : aff_z.c
|
||||
Functii autorizate : write
|
||||
--------------------------------------------------------------------------------
|
||||
Scrieti un program ce ia ca parametru un sir de caractere, si care afiseaza la
|
||||
iesirea standard primul caracter 'z' intalnit in acest sir, urmat de '\n'. Daca
|
||||
nu este intalnit niciun caracter 'z', programul va afisa 'z' urmat de '\n'. Daca
|
||||
numarul de parametri este diferit de 1, programul va afisa 'z' urmat de '\n'.
|
||||
|
||||
Example:
|
||||
|
||||
$> ./aff_z "abc" | cat -e
|
||||
z$
|
||||
$> ./aff_z "dubO a POIL" | cat -e
|
||||
z$
|
||||
$> ./aff_z "zaz sent le poney" | cat -e
|
||||
z$
|
||||
$> ./aff_z | cat -e
|
||||
z$
|
6
exam-basedir03/subjects/brainfuck/examples.txt
Normal file
6
exam-basedir03/subjects/brainfuck/examples.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
$>./brainfuck "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." | cat -e
|
||||
Hello World!$
|
||||
$>./brainfuck "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>." | cat -e
|
||||
Hi$
|
||||
$>./brainfuck | cat -e
|
||||
$
|
32
exam-basedir03/subjects/brainfuck/subject.en.txt
Normal file
32
exam-basedir03/subjects/brainfuck/subject.en.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
Assignment name : brainfuck
|
||||
Expected files : *.c, *.h
|
||||
Allowed functions: write, malloc, free
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Write a Brainfuck interpreter program.
|
||||
The source code will be given as first parameter.
|
||||
The code will always be valid, with no more than 4096 operations.
|
||||
Brainfuck is a minimalist language. It consists of an array of bytes
|
||||
(in our case, let's say 2048 bytes) initialized to zero,
|
||||
and a pointer to its first byte.
|
||||
|
||||
Every operator consists of a single character :
|
||||
- '>' increment the pointer ;
|
||||
- '<' decrement the pointer ;
|
||||
- '+' increment the pointed byte ;
|
||||
- '-' decrement the pointed byte ;
|
||||
- '.' print the pointed byte on standard output ;
|
||||
- '[' go to the matching ']' if the pointed byte is 0 (while start) ;
|
||||
- ']' go to the matching '[' if the pointed byte is not 0 (while end).
|
||||
|
||||
Any other character is a comment.
|
||||
|
||||
Examples:
|
||||
|
||||
$>./brainfuck "++++++++++[>+++++++>++++++++++>+++>+<<<<-]
|
||||
>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." | cat -e
|
||||
Hello World!$
|
||||
$>./brainfuck "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>." | cat -e
|
||||
Hi$
|
||||
$>./brainfuck | cat -e
|
||||
$
|
32
exam-basedir03/subjects/brainfuck/subject.fr.txt
Normal file
32
exam-basedir03/subjects/brainfuck/subject.fr.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
Assignment name : brainfuck
|
||||
Expected files : *.c, *.h
|
||||
Allowed functions: write, malloc, free
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Écrire un programme capable d'interpréter du Brainfuck.
|
||||
Le code source sera passé en premier paramètre.
|
||||
Le code transmis sera toujours valide, et ne comportera pas plus de 4096 opérations.
|
||||
Le Brainfuck est un langage minimaliste constitué d'un tableau d'octets
|
||||
(dans le cadre de cet exercice, 2048 octets) tous initialisés à 0,
|
||||
et d'un pointeur sur son premier octet.
|
||||
|
||||
Voici les différents opérateurs du Brainfuck :
|
||||
- '>' incrémente le pointeur ;
|
||||
- '<' décrémente le pointeur ;
|
||||
- '+' incrémente l'octet pointé ;
|
||||
- '-' décrémente l'octet pointé ;
|
||||
- '.' affiche l'octet pointé sur la sortie standard ;
|
||||
- '[' va au ']' correspondant si l'octet pointé est égal à 0 (début de boucle) ;
|
||||
- ']' va au '[' correspondant si l'octet pointé est différent de 0 (fin de boucle).
|
||||
|
||||
Tout autre caractère est un commentaire.
|
||||
|
||||
Exemples:
|
||||
|
||||
$>./brainfuck "++++++++++[>+++++++>++++++++++>+++>+<<<<-]
|
||||
>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." | cat -e
|
||||
Hello World!$
|
||||
$>./brainfuck "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>." | cat -e
|
||||
Hi$
|
||||
$>./brainfuck | cat -e
|
||||
$
|
32
exam-basedir03/subjects/brainfuck/subject.ro.txt
Normal file
32
exam-basedir03/subjects/brainfuck/subject.ro.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
Exercitiu : brainfuck
|
||||
Fisiere de iesire : *.c, *.h
|
||||
Functii autorizate : write, malloc, free
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Scrieti un interpretor de programe numit Brainfuck.
|
||||
Codul sursa va fi dat ca primul argument.
|
||||
Codul va fi mereu valid, cu cel mult 4096 operatii.
|
||||
Barinfuck este un limbaj minimal. Contine un vector de bytes
|
||||
(pentru acest exercitiu, 2048 bytes) initializati cu zero, si
|
||||
un pointer spre primul byte.
|
||||
|
||||
Fiecare operator consista dintr-un singur caracter:
|
||||
- '>' incrementeaza pointerul ;
|
||||
- '<' decrementeaza pointerul ;
|
||||
- '+' incrementeaza byte-ul la care pointeaza ;
|
||||
- '-' decrementeaza byte-ul la care pointeaza ;
|
||||
- '.' printeaza la iesirea standard byte-ul spre care pointeaza ;
|
||||
- '[' du-te la perechea ']' byte-ul la care pointeaza e 0 (while start) ;
|
||||
- ']' du-te la perechea '[' byte-ul la care pointeaza nu e 0 (while end).
|
||||
|
||||
Orice alt caracter este un comentariu.
|
||||
|
||||
Examples:
|
||||
|
||||
$>./brainfuck "++++++++++[>+++++++>++++++++++>+++>+<<<<-]
|
||||
>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." | cat -e
|
||||
Hello World!$
|
||||
$>./brainfuck "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>." | cat -e
|
||||
Hi$
|
||||
$>./brainfuck | cat -e
|
||||
$
|
60
exam-basedir03/subjects/flood_fill/subject.en.txt
Normal file
60
exam-basedir03/subjects/flood_fill/subject.en.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
Assignment name : flood_fill
|
||||
Expected files : *.c, *.h
|
||||
Allowed functions: -
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Write a function that takes a char ** as a 2-dimensional array of char, a
|
||||
t_point as the dimensions of this array and a t_point as the starting point.
|
||||
|
||||
Starting from the given 'begin' t_point, this function 'colors' an entire zone
|
||||
by replacing characters inside by the character 'F'. A zone is an ensemble of
|
||||
the same character delimitated horizontally and vertically by other characters.
|
||||
|
||||
The flood_fill function won't 'color' in diagonal.
|
||||
|
||||
The flood_fill function will be prototyped like this:
|
||||
void flood_fill(char **tab, t_point size, t_point begin);
|
||||
|
||||
The t_point structure is available inside the "t_point.h" file attached to this
|
||||
assignment. We will use our "t_point.h" for graduation.
|
||||
|
||||
Example :
|
||||
|
||||
$> cat test_main.c
|
||||
#include "test_functions.h"
|
||||
#include "flood_fill.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char **area;
|
||||
t_point size = { 8, 5 };
|
||||
t_point begin = { 2, 2 };
|
||||
char *zone[] = {
|
||||
"11111111",
|
||||
"10001001",
|
||||
"10010001",
|
||||
"10110001",
|
||||
"11100001"
|
||||
};
|
||||
|
||||
area = make_area(zone);
|
||||
print_tab(area);
|
||||
flood_fill(area, size, begin);
|
||||
putc('\n');
|
||||
print_tab(area);
|
||||
return (0);
|
||||
}
|
||||
|
||||
$> gcc flood_fill.c test_main.c test_functions.c -o flood_fill ; ./flood_fill
|
||||
1 1 1 1 1 1 1 1
|
||||
1 0 0 0 1 0 0 1
|
||||
1 0 0 1 0 0 0 1
|
||||
1 0 1 1 0 0 0 1
|
||||
1 1 1 0 0 0 0 1
|
||||
|
||||
1 1 1 1 1 1 1 1
|
||||
1 F F F 1 0 0 1
|
||||
1 F F 1 0 0 0 1
|
||||
1 F 1 1 0 0 0 1
|
||||
1 1 1 0 0 0 0 1
|
||||
$>
|
62
exam-basedir03/subjects/flood_fill/subject.fr.txt
Normal file
62
exam-basedir03/subjects/flood_fill/subject.fr.txt
Normal file
@@ -0,0 +1,62 @@
|
||||
Assignment name : flood_fill
|
||||
Expected files : *.c, *.h
|
||||
Allowed functions: -
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Ecrivez une fonction qui prends en paramètres un char** qui sera une aire à 2
|
||||
dimensions, une structure de type t_point qui donnera la longueur et la largeur
|
||||
de cette aire, et une structure de type t_point symbolisant le point de départ.
|
||||
|
||||
Cette fonction devra 'colorer' une zone de l'aire donnée en argument, en
|
||||
remplaçant les caractères de cette zone par des 'F'. Une zone est un ensemble
|
||||
de mêmes caractères, délimitée horizontalement et verticalement par d'autres
|
||||
caractères.
|
||||
|
||||
La fonction flood_fill ne 'colore' pas en diagonale.
|
||||
|
||||
La fonction flood_fill devra être prototypée comme suit :
|
||||
void flood_fill(char **tab, t_point size, t_point begin);
|
||||
|
||||
La structure t_point est présente dans le fichier "t_point.h" mis en annexe
|
||||
de ce sujet. Nous utiliserons notre "t_point.h" pour le rendu.
|
||||
|
||||
Exemple:
|
||||
|
||||
$>cat test_main.c
|
||||
#include "test_functions.h"
|
||||
#include "t_point.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char **area;
|
||||
t_point size = { 8, 5 };
|
||||
t_point begin = { 2, 2 };
|
||||
char *zone[] = {
|
||||
"11111111",
|
||||
"10001001",
|
||||
"10010001",
|
||||
"10110001",
|
||||
"11100001"
|
||||
};
|
||||
|
||||
area = make_area(zone);
|
||||
print_tab(area);
|
||||
flood_fill(area, size, begin);
|
||||
putc('\n');
|
||||
print_tab(area);
|
||||
return (0);
|
||||
}
|
||||
|
||||
$> gcc flood_fill.c test_main.c test_functions.c -o flood_fill ; ./flood_fill
|
||||
1 1 1 1 1 1 1 1
|
||||
1 0 0 0 1 0 0 1
|
||||
1 0 0 1 0 0 0 1
|
||||
1 0 1 1 0 0 0 1
|
||||
1 1 1 0 0 0 0 1
|
||||
|
||||
1 1 1 1 1 1 1 1
|
||||
1 F F F 1 0 0 1
|
||||
1 F F 1 0 0 0 1
|
||||
1 F 1 1 0 0 0 1
|
||||
1 1 1 0 0 0 0 1
|
||||
$>
|
10
exam-basedir03/subjects/flood_fill/t_point.h
Normal file
10
exam-basedir03/subjects/flood_fill/t_point.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef T_POINT_FLOOD_FILL
|
||||
# define T_POINT_FLOOD_FILL
|
||||
|
||||
typedef struct s_point {
|
||||
int x; // x : Width | x-axis
|
||||
int y; // y : Height | y-axis
|
||||
} t_point;
|
||||
|
||||
#endif
|
||||
|
20
exam-basedir03/subjects/ft_atoi_base/subject.en.txt
Normal file
20
exam-basedir03/subjects/ft_atoi_base/subject.en.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
Assignment name : ft_atoi_base
|
||||
Expected files : ft_atoi_base.c
|
||||
Allowed functions: None
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Write a function that converts the string argument str (base N <= 16)
|
||||
to an integer (base 10) and returns it.
|
||||
|
||||
The characters recognized in the input are: 0123456789abcdef
|
||||
Those are, of course, to be trimmed according to the requested base. For
|
||||
example, base 4 recognizes "0123" and base 16 recognizes "0123456789abcdef".
|
||||
|
||||
Uppercase letters must also be recognized: "12fdb3" is the same as "12FDB3".
|
||||
|
||||
Minus signs ('-') are interpreted only if they are the first character of the
|
||||
string.
|
||||
|
||||
Your function must be declared as follows:
|
||||
|
||||
int ft_atoi_base(const char *str, int str_base);
|
21
exam-basedir03/subjects/ft_atoi_base/subject.fr.txt
Normal file
21
exam-basedir03/subjects/ft_atoi_base/subject.fr.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
Assignment name : ft_atoi_base
|
||||
Expected files : ft_atoi_base.c
|
||||
Allowed functions: None
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Écrire une fonction qui convertit son argument 'str', une chaîne (en base N <= 16)
|
||||
en un entier (base 10) et le retourne.
|
||||
|
||||
Les caractères reconnus dans l'entrée sont : 0123456789abcdef
|
||||
Bien entendu, la base demandée conditionne le nombre de caractères à prendre
|
||||
en compte. Par exemple, la base 4 reconnaîtra "0123" et la base 16 reconnaîtra
|
||||
"0123456789abcdef".
|
||||
|
||||
Les majuscules marchent aussi : "12fdb3" est pareil que "12FDB3".
|
||||
|
||||
Les caractères '-' doivent être interprétés seulement s'ils sont en première
|
||||
position dans la chaîne.
|
||||
|
||||
Votre fonction sera déclarée comme suit:
|
||||
|
||||
int ft_atoi_base(const char *str, int str_base);
|
11
exam-basedir03/subjects/ft_itoa/subject.en.txt
Normal file
11
exam-basedir03/subjects/ft_itoa/subject.en.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Assignment name : ft_itoa
|
||||
Expected files : ft_itoa.c
|
||||
Allowed functions: malloc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Write a function that takes an int and converts it to a null-terminated string.
|
||||
The function returns the result in a char array that you must allocate.
|
||||
|
||||
Your function must be declared as follows:
|
||||
|
||||
char *ft_itoa(int nbr);
|
12
exam-basedir03/subjects/ft_itoa/subject.fr.txt
Normal file
12
exam-basedir03/subjects/ft_itoa/subject.fr.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
Assignment name : ft_itoa
|
||||
Expected files : ft_itoa.c
|
||||
Allowed functions: malloc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Écrire une fonction qui prend un int et le convertit en chaîne terminée par un
|
||||
caractère nul. Cette fonction retourne le résultat en tant qu'un tableau de
|
||||
char que vous devez allouer.
|
||||
|
||||
Votre fonction sera déclarée comme suit:
|
||||
|
||||
char *ft_itoa(int nbr);
|
10
exam-basedir03/subjects/ft_itoa/subject.ro.txt
Normal file
10
exam-basedir03/subjects/ft_itoa/subject.ro.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Assignment name : ft_itoa
|
||||
Expected files : ft_itoa.c
|
||||
Allowed functions: malloc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Scrieti o functie care primeste un int si il converteste intr-un sir de caractere, care se termina cu null. Functia returneaza resultatul intr-un vector de char pe care trebuie sa il alocati.
|
||||
|
||||
Functia trebuie declarata ca si mai jos:
|
||||
|
||||
char *ft_itoa(int nbr);
|
13
exam-basedir03/subjects/ft_putstr/subject.en.txt
Normal file
13
exam-basedir03/subjects/ft_putstr/subject.en.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
Assignment name : ft_putstr
|
||||
Expected files : ft_putstr.c
|
||||
Allowed functions: write
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Write a function that displays a string on the standard output.
|
||||
|
||||
The pointer passed to the function contains the address of the string's first
|
||||
character.
|
||||
|
||||
Your function must be declared as follows:
|
||||
|
||||
void ft_putstr(char *str);
|
12
exam-basedir03/subjects/ft_putstr/subject.fr.txt
Normal file
12
exam-basedir03/subjects/ft_putstr/subject.fr.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
Assignment name : ft_putstr
|
||||
Expected files : ft_putstr.c
|
||||
Allowed functions: write
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Écrire une fonction qui affiche une chaîne de caractères sur la sortie standard.
|
||||
|
||||
Le pointeur passé à la fonction est l'adresse du premier caractère de la chaîne.
|
||||
|
||||
Elle devra être prototypée de la façon suivante :
|
||||
|
||||
void ft_putstr(char *str);
|
12
exam-basedir03/subjects/ft_putstr/subject.ro.txt
Normal file
12
exam-basedir03/subjects/ft_putstr/subject.ro.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
Exercitiu : ft_putstr
|
||||
Fisiere de iesire : ft_putstr.c
|
||||
Functii autorizate : write
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Scrieti o functie ce afiseaza un sir de caractere la iesirea standard.
|
||||
|
||||
Pointerul catre functie este adresa primului caracter al sirului.
|
||||
|
||||
Ea trebuie sa aiba prototipul urmator:
|
||||
|
||||
void ft_putstr(char *str);
|
19
exam-basedir03/subjects/ft_rrange/subject.en.txt
Normal file
19
exam-basedir03/subjects/ft_rrange/subject.en.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
Assignment name : ft_rrange
|
||||
Expected files : ft_rrange.c
|
||||
Allowed functions: malloc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Write the following function:
|
||||
|
||||
int *ft_rrange(int start, int end);
|
||||
|
||||
It must allocate (with malloc()) an array of integers, fill it with consecutive
|
||||
values that begin at end and end at start (Including start and end !), then
|
||||
return a pointer to the first value of the array.
|
||||
|
||||
Examples:
|
||||
|
||||
- With (1, 3) you will return an array containing 3, 2 and 1
|
||||
- With (-1, 2) you will return an array containing 2, 1, 0 and -1.
|
||||
- With (0, 0) you will return an array containing 0.
|
||||
- With (0, -3) you will return an array containing -3, -2, -1 and 0.
|
19
exam-basedir03/subjects/ft_rrange/subject.fr.txt
Normal file
19
exam-basedir03/subjects/ft_rrange/subject.fr.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
Assignment name : ft_rrange
|
||||
Expected files : ft_rrange.c
|
||||
Allowed functions: malloc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Écrire la fonction suivante :
|
||||
|
||||
int *ft_rrange(int start, int end);
|
||||
|
||||
Cette fonction doit allouer avec malloc() un tableau d'ints, le remplir avec
|
||||
les valeurs (consécutives) démarrant à end et finissant à start (start et end
|
||||
inclus !), et renvoyer un pointeur vers la première valeur du tableau.
|
||||
|
||||
Exemples:
|
||||
|
||||
- Avec (1, 3) vous devrez renvoyer un tableau contenant 3, 2 et 1.
|
||||
- Avec (-1, 2) vous devrez renvoyer un tableau contenant 2, 1, 0 et -1.
|
||||
- Avec (0, 0) vous devrez renvoyer un tableau contenant 0.
|
||||
- Avec (0, -3) vous devrez renvoyer un tableau contenant -3, -2, -1 et 0.
|
22
exam-basedir03/subjects/ft_rrange/subject.ro.txt
Normal file
22
exam-basedir03/subjects/ft_rrange/subject.ro.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
Exercitiu : ft_rrange
|
||||
Fisier de iesire : ft_rrange.c
|
||||
Functii autorizate : malloc
|
||||
--------------------------------------------------------------------------------
|
||||
Scrieti functia urmatoare:
|
||||
|
||||
int *ft_rrange(int start, int end);
|
||||
|
||||
Aceasta functie trebuie sa aloce cu ajutorul functiei malloc() un tablou de
|
||||
intregi si sa-l umple valori (consecutive) incepand cu endsi terminand cu start
|
||||
(start si end incluse!), si sa returneze un pointer spre prima valoare a tabloului.
|
||||
|
||||
Exemplu:
|
||||
|
||||
|
||||
Cu parametri (1, 3) trebuie sa returnati un tablou continand valorile 3, 2 si 1.
|
||||
|
||||
Cu parametri (-1, 2) trebuie sa returnati un tablou continand valorile 2, 1, 0 si -1.
|
||||
|
||||
Cu parametri (0, 0) trebuie sa returnati un tablou continand valorile 0.
|
||||
|
||||
Cu parametri (0, -3) trebuie sa returnati un tablou continand valorile -3, -2, -1 si 0.
|
14
exam-basedir03/subjects/ft_split/subject.en.txt
Normal file
14
exam-basedir03/subjects/ft_split/subject.en.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
Assignment name : ft_split
|
||||
Expected files : ft_split.c
|
||||
Allowed functions: malloc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Write a function that takes a string, splits it into words, and returns them as
|
||||
a NULL-terminated array of strings.
|
||||
|
||||
A "word" is defined as a part of a string delimited either by spaces/tabs/new
|
||||
lines, or by the start/end of the string.
|
||||
|
||||
Your function must be declared as follows:
|
||||
|
||||
char **ft_split(char *str);
|
16
exam-basedir03/subjects/ft_split/subject.fr.txt
Normal file
16
exam-basedir03/subjects/ft_split/subject.fr.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
Assignment name : ft_split
|
||||
Expected files : ft_split.c
|
||||
Allowed functions: malloc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Écrire une fonction qui prend en paramètre une chaîne de caractères et la
|
||||
découpe en mots, qui seront retournés sous la forme d'un tableau de chaînes
|
||||
terminé par NULL.
|
||||
|
||||
On appelle "mot" une portion de chaîne de caractères délimitée soit par des
|
||||
espaces, des retours à la ligne et/ou des tabulations, soit par le début / fin
|
||||
de la chaîne.
|
||||
|
||||
Votre fonction devra être prototypée de la façon suivante :
|
||||
|
||||
char **ft_split(char *str);
|
15
exam-basedir03/subjects/ft_split/subject.ro.txt
Normal file
15
exam-basedir03/subjects/ft_split/subject.ro.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
Exercitiu : ft_split
|
||||
Fisier de iesire : ft_split.c
|
||||
Functii autorizate : malloc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Scrieti o functie ce ia ca parametru un sir de caractere si pe care il separa
|
||||
in cuvinte, ce vor fi returnate sub forma unui tablou siruri terminate cu NULL.
|
||||
|
||||
Numim "cuvant" o portiune a a sirului de caractere delimitate de fie de spatii
|
||||
si/sau tabulatoare, fie de inceputul/sfarsitul sirului.
|
||||
|
||||
Functia va trebui sa aiba urmatorul prototip:
|
||||
|
||||
char **ft_split(char *str);
|
||||
|
15
exam-basedir03/subjects/max/subject.en.txt
Normal file
15
exam-basedir03/subjects/max/subject.en.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
Assignment name : max
|
||||
Expected files : max.c
|
||||
Allowed functions:
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Write the following function:
|
||||
|
||||
int max(int* tab, unsigned int len);
|
||||
|
||||
The first parameter is an array of int, the second is the number of elements in
|
||||
the array.
|
||||
|
||||
The function returns the largest number found in the array.
|
||||
|
||||
If the array is empty, the function returns 0.
|
15
exam-basedir03/subjects/max/subject.fr.txt
Normal file
15
exam-basedir03/subjects/max/subject.fr.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
Assignment name : max
|
||||
Expected files : max.c
|
||||
Allowed functions:
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Écrire la fonction suivante:
|
||||
|
||||
int max(int *tab, unsigned int len);
|
||||
|
||||
Le premier paramètre est un tableau d'int, le deuxième est le nombre d'éléments
|
||||
contenus dans ce tableau.
|
||||
|
||||
La fonction renvoie le plus grand nombre trouvé dans le tableau.
|
||||
|
||||
Si le tableau est vide, la fonction renvoie 0.
|
15
exam-basedir03/subjects/max/subject.ro.txt
Normal file
15
exam-basedir03/subjects/max/subject.ro.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
Exercitiu : max
|
||||
Fisiere de iesire : max.c
|
||||
Functii autorizate :
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Scrieti functia urmatoare:
|
||||
|
||||
int max(int* tab, unsigned int len);
|
||||
|
||||
Primul parametru este un tablou de intregi, al doile este numarul de elemente
|
||||
continute in tablou.
|
||||
|
||||
Functia trebuie sa returmeze cel mai mare numar gasit in tablou.
|
||||
|
||||
Daca tabloul este vid, functia va returna 0.
|
29
exam-basedir03/subjects/moment/subject.en.txt
Normal file
29
exam-basedir03/subjects/moment/subject.en.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
Assignment name : moment
|
||||
Expected files : moment.c
|
||||
Allowed functions: malloc, free
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Create a function that takes a duration in seconds as parameter and returns a
|
||||
string with the number of seconds, minutes, hours, days or months elapsed.
|
||||
This function supposes that months are 30-days long and ignores leap years.
|
||||
|
||||
The format of this string will be :
|
||||
|
||||
xxx {second(s)|minute(s)|hour(s)|day(s)|month(s)} ago.
|
||||
|
||||
Your function should return the lowest possible value (as you can see below
|
||||
in the examples).
|
||||
|
||||
The prototype of this function will be :
|
||||
|
||||
char *moment(unsigned int duration)
|
||||
|
||||
Examples:
|
||||
|
||||
moment(0) => 0 seconds ago.
|
||||
moment(1) => 1 second ago.
|
||||
moment(30) => 30 seconds ago.
|
||||
moment(65) => 1 minute ago.
|
||||
moment(120) => 2 minutes ago.
|
||||
moment(2400) => 40 minutes ago.
|
||||
moment(3735) => 1 hour ago.
|
28
exam-basedir03/subjects/moment/subject.fr.txt
Normal file
28
exam-basedir03/subjects/moment/subject.fr.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
Assignment name : moment
|
||||
Expected files : moment.c
|
||||
Allowed functions: malloc, free
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Créer une fonction qui prends un unsigned int en paramètre, représentant une
|
||||
potentielle durée en secondes, et renvoie une chaîne de caractères qui indique le
|
||||
nombre de secondes / minutes / heures / jours ou mois écoulés.
|
||||
On supposera que les mois font 30 jours de long et on ignore les années bissextiles.
|
||||
|
||||
Le format de sortie sera :
|
||||
|
||||
xxx {second(s)|minute(s)|hour(s)|day(s)|month(s)} ago.
|
||||
|
||||
Votre fonction ne renverra que la durée avec la valeur la plus basse possible.
|
||||
La fonction sera prototypée comme suit:
|
||||
|
||||
char *moment(unsigned int duration)
|
||||
|
||||
Exemples:
|
||||
|
||||
moment(0) => 0 seconds ago.
|
||||
moment(1) => 1 second ago.
|
||||
moment(30) => 30 seconds ago.
|
||||
moment(65) => 1 minute ago.
|
||||
moment(120) => 2 minutes ago.
|
||||
moment(2400) => 40 minutes ago.
|
||||
moment(3735) => 1 hour ago.
|
29
exam-basedir03/subjects/rev_wstr/subject.en.txt
Normal file
29
exam-basedir03/subjects/rev_wstr/subject.en.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
Assignment name : rev_wstr
|
||||
Expected files : rev_wstr.c
|
||||
Allowed functions: write, malloc, free
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Write a program that takes a string as a parameter, and prints its words in
|
||||
reverse order.
|
||||
|
||||
A "word" is a part of the string bounded by spaces and/or tabs, or the
|
||||
begin/end of the string.
|
||||
|
||||
If the number of parameters is different from 1, the program will display
|
||||
'\n'.
|
||||
|
||||
In the parameters that are going to be tested, there won't be any "additional"
|
||||
spaces (meaning that there won't be additionnal spaces at the beginning or at
|
||||
the end of the string, and words will always be separated by exactly one space).
|
||||
|
||||
Examples:
|
||||
|
||||
$> ./rev_wstr "You hate people! But I love gatherings. Isn't it ironic?" | cat -e
|
||||
ironic? it Isn't gatherings. love I But people! hate You$
|
||||
$>./rev_wstr "abcdefghijklm"
|
||||
abcdefghijklm
|
||||
$> ./rev_wstr "Wingardium Leviosa" | cat -e
|
||||
Leviosa Wingardium$
|
||||
$> ./rev_wstr | cat -e
|
||||
$
|
||||
$>
|
29
exam-basedir03/subjects/rev_wstr/subject.fr.txt
Normal file
29
exam-basedir03/subjects/rev_wstr/subject.fr.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
Assignment name : rev_wstr
|
||||
Expected files : rev_wstr.c
|
||||
Allowed functions: write, malloc, free
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Écrire un programme qui prend en paramètre une chaîne de caractères, et qui
|
||||
affiche cette chaîne en inversant ses mots.
|
||||
|
||||
On appelle "mot" une portion de chaîne de caractères délimitée soit par des
|
||||
espaces et/ou des tabulations, soit par le début / fin de la chaîne.
|
||||
|
||||
Si le nombre de paramètres est différent de 1, le programme devra afficher
|
||||
'\n'.
|
||||
|
||||
Dans les paramètres qui seront testés, il n'y aura pas d'espaces "en trop"
|
||||
(comprendre par là qu'il n'y aura pas d'espaces au début ou à la fin de la
|
||||
chaîne, et que les mots seront toujours séparés par exactement un espace).
|
||||
|
||||
Exemple:
|
||||
|
||||
$> ./rev_wstr "le temps du mepris precede celui de l'indifference" | cat -e
|
||||
l'indifference de celui precede mepris du temps le$
|
||||
$> ./rev_wstr "abcdefghijklm"
|
||||
abcdefghijklm
|
||||
$> ./rev_wstr "il contempla le mont" | cat -e
|
||||
mont le contempla il$
|
||||
$> ./rev_wstr | cat -e
|
||||
$
|
||||
$>
|
27
exam-basedir03/subjects/rev_wstr/subject.ro.txt
Normal file
27
exam-basedir03/subjects/rev_wstr/subject.ro.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
Exercitiu : rev_wstr
|
||||
Fisiere de iesire : rev_wstr.c
|
||||
Functii autorizate : write, malloc, free
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Scrieti un program ce ia ca parametru un sir de caractere si care afiseaza acest
|
||||
sir inversand cuvintele sale.
|
||||
|
||||
Numim "cuvant" o portiune a sirului de caractere delimitat, fie de spatiu si/sau
|
||||
tabulator, fie de inceputul/sfarsitul sirului.
|
||||
|
||||
Daca numarul de parametri este diferit de 1, programul va afisa '\n'.
|
||||
|
||||
Sirurile ce urmeaza a fi testate nu vor contine spatii nici la inceput si nici
|
||||
la sfarsitul acestora si ca cuvintele vor fi separate intotdeauna printr-un spatiu.
|
||||
|
||||
Exemplu:
|
||||
|
||||
$> ./rev_wstr "le temps du mepris precede celui de l'indifference" | cat -e
|
||||
l'indifference de celui precede mepris du temps le$
|
||||
$> ./rev_wstr "abcdefghijklm"
|
||||
abcdefghijklm
|
||||
$> ./rev_wstr "il contempla le mont" | cat -e
|
||||
mont le contempla il$
|
||||
$> ./rev_wstr | cat -e
|
||||
$
|
||||
$>
|
Reference in New Issue
Block a user