diff --git a/DEV1.1/TP17/exo1/Makefile b/DEV1.1/TP17/exo1/Makefile index 7553f89..f19529c 100644 --- a/DEV1.1/TP17/exo1/Makefile +++ b/DEV1.1/TP17/exo1/Makefile @@ -9,7 +9,8 @@ but : exo1 OFILES = lire.o \ personne.o \ repertoire.o \ - main.o + main.o\ + option.o CC = gcc @@ -21,7 +22,9 @@ personne.o : personne.h lire.h repertoire.o : repertoire.h personne.h -main.o : personne.h repertoire.h +main.o : personne.h repertoire.h option.h + +option.o : option.h #CHAPITRE 4 : DEPENDANCES AVEC COMMANDES diff --git a/DEV1.1/TP17/exo1/exo1 b/DEV1.1/TP17/exo1/exo1 index 96285d2..c98d4c3 100755 Binary files a/DEV1.1/TP17/exo1/exo1 and b/DEV1.1/TP17/exo1/exo1 differ diff --git a/DEV1.1/TP17/exo1/main.c b/DEV1.1/TP17/exo1/main.c index e182a76..88e0730 100644 --- a/DEV1.1/TP17/exo1/main.c +++ b/DEV1.1/TP17/exo1/main.c @@ -4,24 +4,7 @@ #include #include "personne.h" #include "repertoire.h" - -typedef enum {AJOUTER, AFFICHER, SORTIR} options; - -options saisir_option() { - short o; - printf("\nChoisissez une option :\n"); - printf("1] Ajouter une personne.\n"); - printf("2] Afficher le repertoire.\n"); - printf("3] Sortir\n"); - printf("? "); - scanf("%hd", &o); - switch(o) { - case 1 : return AJOUTER; - case 2 : return AFFICHER; - case 3 : return SORTIR; - default : return AFFICHER; - } -} +#include "option.h" int main(void) { options opt; diff --git a/DEV1.1/TP17/exo1/option.c b/DEV1.1/TP17/exo1/option.c new file mode 100644 index 0000000..f0b7750 --- /dev/null +++ b/DEV1.1/TP17/exo1/option.c @@ -0,0 +1,20 @@ +#include +#include +#include "option.h" + + +options saisir_option() { + short o; + printf("\nChoisissez une option :\n"); + printf("1] Ajouter une personne.\n"); + printf("2] Afficher le repertoire.\n"); + printf("3] Sortir\n"); + printf("? "); + scanf("%hd", &o); + switch(o) { + case 1 : return AJOUTER; + case 2 : return AFFICHER; + case 3 : return SORTIR; + default : return AFFICHER; + } +} \ No newline at end of file diff --git a/DEV1.1/TP17/exo1/option.h b/DEV1.1/TP17/exo1/option.h new file mode 100644 index 0000000..6eb380d --- /dev/null +++ b/DEV1.1/TP17/exo1/option.h @@ -0,0 +1,10 @@ +/* TP 19 Exercice 1 : fichier option.h */ + +#ifndef OPTION_H +#define OPTION_H + +typedef enum {AJOUTER, AFFICHER, SORTIR} options; + +options saisir_option(); + +#endif /* OPTION_H/ diff --git a/DEV1.1/TP17/new 2.txt b/DEV1.1/TP17/new 2.txt deleted file mode 100644 index f2a0ce5..0000000 --- a/DEV1.1/TP17/new 2.txt +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _GRAPH_H -#define _GRAPH_H -: protection contre les inclusions multiples - -#include : une directive d'inclusion - -#define NB_PIXMAP 10 : création d'une constante - -void CacherFenetre(void); :prototype d'une fonction - -/* cache la fenetre */ : une directive de définition - -extern int _Y; : une déclaration externe de variable globale - -typedef unsigned long couleur; :une déclaration de type \ No newline at end of file diff --git a/DEV1.1/TP18/singleton b/DEV1.1/TP18/singleton new file mode 100755 index 0000000..6abb777 Binary files /dev/null and b/DEV1.1/TP18/singleton differ diff --git a/DEV1.1/TP18/singleton.c b/DEV1.1/TP18/singleton.c new file mode 100644 index 0000000..c4e3de5 --- /dev/null +++ b/DEV1.1/TP18/singleton.c @@ -0,0 +1,36 @@ +#include +#include + + +int main(void) { + int taille,val=1,val1,occ; + int* tab=NULL; + int* tab_val=NULL; + printf("Nombre de réel à entrer: "); + scanf("%d",&taille); + tab = (int*) malloc(taille*sizeof(int)); + tab_val = (int*) malloc(taille*sizeof(int)); + printf("Réel à entrer: "); + scanf("%d",tab); + while(val