Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
- #include "tp3.h"
- int main(void){
- char choixMenu = '\0';
- float note;
- char matiere[20], prenom[26], nom[26];
- int idEtu;
- T_Etudiant etudiant;
- T_ListeEtu listeEtu = NULL;
- do {
- afficherMenu();
- switch (choixMenu) {
- case '1':
- if (listeEtu == NULL){
- printf("ID : ");
- scanf("%d", &idEtu);
- printf("Prenom : ");
- scanf("%s", prenom);
- printf("Nom : ");
- scanf("%s", nom);
- listeEtu = creerEtudiant(idEtu, nom, prenom);
- printf("Pour finaliser la creation, entrer une matiere : ");
- scanf("%s", matiere);
- do{
- printf("Note entre 0 et 20 : ");
- scanf("%f", ¬e);
- } while(note < 0 || note > 20);
- listeEtu = ajouterNoteEtu(note, matiere, idEtu, listeEtu);
- break;
- }
- system("clear");
- printf("La liste n'est pas vide, utilisez l'option 2\n");
- sleep(2);
- break;
- case '2':
- system("clear");
- do{
- printf("Note entre 0 et 20 : ");
- scanf("%f", ¬e);
- } while(note < 0 || note > 20);
- printf("Matiere : ");
- scanf("%s", matiere);
- printf("ID : ");
- scanf("%d", &idEtu);
- listeEtu = ajouterNoteEtu(note, matiere, idEtu, listeEtu);
- break;
- case '3':
- system("clear");
- printf("Matiere : ");
- scanf("%s", matiere);
- printf("ID : ");
- scanf("%d", &idEtu);
- listeEtu = supprimerNoteEtu(matiere, idEtu, listeEtu);
- break;
- case '4':
- afficherListeEtu(listeEtu);
- sleep(2);
- break;
- case '5':
- if (listeEtu != NULL){
- afficherClassement(listeEtu);
- }
- break;
- case '6':
- if (listeEtu != NULL){
- printf("Matiere : ");
- scanf("%s", matiere);
- afficherSousListes(listeEtu, matiere);
- }
- break;
- default:
- printf("Veuillez choisir un numero entre 1 et 7.\n");
- break;
- }
- } while ((choixMenu = getchar()) != '7');
- while(listeEtu != NULL){
- listeEtu = supprimerNoteEtu(listeEtu->notes->matiere, listeEtu->id, listeEtu);
- }
- system("clear");
- printf("Mémoire libérée\n");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement