debut TP18

This commit is contained in:
2023-11-14 17:28:39 +01:00
parent fd72164c4e
commit 7d4d21b993
8 changed files with 72 additions and 35 deletions

View File

@@ -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.

View File

@@ -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
View 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
View 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/

View File

@@ -1,15 +0,0 @@
#ifndef _GRAPH_H
#define _GRAPH_H
: protection contre les inclusions multiples
#include<X11/Xlib.h> : 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