debut TP18
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Binary file not shown.
@@ -4,24 +4,7 @@
|
||||
#include <stdio.h>
|
||||
#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;
|
||||
|
||||
20
DEV1.1/TP17/exo1/option.c
Normal file
20
DEV1.1/TP17/exo1/option.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#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;
|
||||
}
|
||||
}
|
||||
10
DEV1.1/TP17/exo1/option.h
Normal file
10
DEV1.1/TP17/exo1/option.h
Normal file
@@ -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/
|
||||
Reference in New Issue
Block a user