#include "fonction.h" //explication de l'utilisation du menu void commande() { printf("que voulez vous faire ? \n1 = afficher les realisteurs\n2 = chercher et selectionner un realisteur\n3 = afficher le realisateur selectionner\n4 = effacer le realisateur selectionner\n5 = ajouter un film au realisateur selectionner\n6 = effacer un film au realisateur selectioner\n7 = ajouter un realisateur\n8 = quitter \n"); } // Menu du programme void menu(tableReal table) { int QUITTER = 0; int choix = 0; char nom[LINE_MAX]; char prenom[LINE_MAX]; char nomNew[LINE_MAX]; char prenomNew[LINE_MAX]; char titre[LINE_MAX]; ptrealisateur pt = NULL; commande(); while(QUITTER==0) { while(choix == 0) { scanf("%d",&choix); if(choix > 8 || choix < 0) choix = 0; system("cls"); } switch(choix) { case 1: // afficher un realisateur { commande(); afficherTable(table); choix = 0; break; } case 2: // chercher un realisateur { commande(); printf("chercher, nom : "); scanf("%s",&nom); printf("prenom : "); scanf("%s",&prenom); pt = findReal(table,nom,prenom); choix = 0; break; } case 3: //afficher un realisteur selectionne { commande(); if(pt != NULL) afficherReal(table,pt->nom,pt->prenom); else printf("pas de realisateur selectionner !"); choix = 0; break; } case 4: // supprimer un realisateur selectionne { commande(); if(pt != NULL) eraseReal(table,pt->nom,pt->prenom); else printf("pas de realisateur selectionner !"); choix = 0; break; } case 5: // ajouter un film dans le realisateur selectionne { commande(); if(pt != NULL) addFilm(table,pt->nom,pt->prenom); else printf("pas de realisateur selectionner !"); choix = 0; break; } case 6: //supprimer un film dans le realisateur selectionne { commande(); if(pt != NULL) { printf("nom du film à effacer :"); scanf("%s",titre); eraseFilm(pt,titre); } else printf("pas de realisateur selectionner !"); choix = 0; break; } case 7: // ajouter un realisateur { commande(); printf("ajouter : nom : "); scanf("%s",&nomNew); printf("prenom : "); scanf("%s",&prenomNew); addReal(table,nomNew,prenomNew); choix = 0; break; } case 8: // quitter { printf("bye bitches !"); QUITTER = 1; break; } } } } // Initialisation de tous les paramètres void init() { tableReal table; initTable(table); FILE* fichier = NULL; fichier = fopen("very_small_example.list", "r+"); readFile(fichier,table); fclose(fichier); menu(table); } int main() { init(); return 0; }