From 8b13f2fbe9c2a4bdff2406999d7546a25240e0a3 Mon Sep 17 00:00:00 2001 From: rubisalpha Date: Fri, 13 Feb 2026 13:08:04 +0000 Subject: [PATCH] Actualiser main.cpp --- main.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/main.cpp b/main.cpp index d4f4d50..25cc559 100644 --- a/main.cpp +++ b/main.cpp @@ -6,30 +6,75 @@ User users[] = { {"admin", "1234", ADMIN}, {"prof1", "abcd", PROF}, - {"student1", "pass", STUDENT} + {"student1", "pass", STUDENT}, + {"student2", "123", STUDENT}, + {"student3", "abc", STUDENT} }; -int nbUsers = 3; +int nbUsers = 5; + +// Tableau d'étudiants et leurs notes +struct Student { + std::string nom; + int notes[3]; +}; + +Student etudiants[] = { + {"student1", {15, 12, 18}}, + {"student2", {14, 10, 16}}, + {"student3", {13, 11, 17}} +}; +int nbEtudiants = 3; + +// --- Fonctions de vues selon rôle --- -// Fonctions de vues selon le rôle void viewAdmin() { std::cout << "\n--- VUE ADMIN ---\n"; - std::cout << "1. Gérer étudiants\n"; - std::cout << "2. Gérer cours\n"; - std::cout << "3. Gérer notes\n"; + std::cout << "Liste des étudiants et notes :\n"; + for(int i=0; i> id; + if(id>=0 && id> noteIndex; + std::cout << "Nouvelle note : "; + std::cin >> newNote; + etudiants[id].notes[noteIndex] = newNote; + std::cout << "Note modifiée avec succès !\n"; + } } void viewStudent(const User& user) { std::cout << "\n--- VUE STUDENT ---\n"; - std::cout << "Nom : " << user.login << "\n"; - std::cout << "Notes : 15, 12, 18\n"; // Exemple simple + for(int i=0; i