diff --git a/adminIut.c b/adminIut.c index 68deb4f..e69de29 100644 --- a/adminIut.c +++ b/adminIut.c @@ -1,137 +0,0 @@ -#include -#include -#include -#include "iut.h" - -void MenuAdministrateur(VilleIUT *tiut[],int n){ - char departement[30],respon[30],Vmodif[31]; - int choix,nbp,i,comp,Mnbp; - VilleIUT V; - - printf("\n1-Modifier place\n2-Creer un departement\n3-supprimer un département\n4-Lancer et Arreter la phase de canditature\n5-modifier nom responsable :"); - scanf("\n%d",&choix); - if(choix==1){ - printf("\nVille où se situe le departement à modifier :"); - scanf("%s",Vmodif); - printf("\ndepartement à modifier:"); - scanf("%s",departement); - printf("\nnombre de place apres modification :"); - scanf("%d",&Mnbp); - - for(i=0;iville, Vmodif); - if(comp==0){ - tiut[i]->ldept=ModifinbP(tiut[i]->ldept,departement,Mnbp,n); - } - } - - } - if(choix==2){ - //creer departemement - printf("\nVille où se situe le departement :"); - scanf("%s",Vmodif); - printf("\ndepartement a creer :"); - scanf("%s",departement); - printf("\nnombre de place :"); - scanf("%d",&nbp); - printf("\nnom du responsable :"); - scanf("%s",respon); - - for(i=0;iville, Vmodif); - if(comp==0){ - tiut[i]->ldept=Enfiler(tiut[i]->ldept,departement,nbp,respon); - } - } - } - if(choix==3){ - //supprimer departement et pauser condition pour choisir qui suppr - printf("\ndepartement :"); - scanf("%s",departement); - printf("\nresponsable :"); - scanf("%s",respon); - // *resultat=recherche(V.Ville,departement,respon); - //m=suppression(m,departement,respon); - affichage(tiut, n); - } - if(choix==4){ - //Lancer et arreter phase de canditature - } - if(choix==5){ - //modification responsable - } - affichage(tiut,n); -} - - -ListeD suppressionTete(ListeD ld){ - ListeD ldsvt; - ldsvt=ld->suivant; - free(ld); - return ldsvt; - } -ListeD suppression(ListeD ld,char *departement,char *responsable){ - if(ld==NULL) - return ld; - if(strcmp(ld->departement,departement) ==0 && strcmp(ld->resp,responsable) ==0) - return suppressionTete(ld); - ld->suivant=suppression(ld->suivant,departement,responsable); - return ld; - } - -ListeD ModifinbP(ListeD ld, char departement[30], int MnbP, int n){ - int comp,trouv,i; - for(i=0;idepartement,departement); - if(comp==0) - trouv=i; - } - if(trouv ==0){ - printf("departement non existant"); - exit(1); - } - else{ - ld[i].nbP=MnbP; - } - return ld; -} - - - -ListeD Enfiler(ListeD ld, char departement[30], int nbP, char resp[30]) { - MaillonDept *mN; - mN = (MaillonDept*)malloc(sizeof(MaillonDept)); - if(mN==NULL){printf("pb ouv malloc");exit(1);} - strcpy(mN->departement, departement); - mN->nbP = nbP; - strcpy(mN->resp, resp); - mN->suivant = NULL; - printf("\naa"); - if (ld == NULL) { - ld = mN; - } else { - MaillonDept *mD; - mD = ld; - while (mD->suivant != NULL) { - mD = mD->suivant; - } - mD->suivant = mN; - } - return ld; -} - -/* -VilleIUT defiler(VilleIUT V){ - MaillonDept *temp; - if(testVide(V)){ - printf("testVide"); - return V; - } - temp=V.Ville; - V.Ville=temp->suivant; - free(temp); - if(V.Ville==NULL) - V.Idept=NULL; - return V; -} -*/ \ No newline at end of file diff --git a/testIut.c b/testIut.c index 6020c6e..97b4577 100644 --- a/testIut.c +++ b/testIut.c @@ -14,11 +14,11 @@ int main(){ printf("\n\nUtilisateur - 1\tAdministrateur - 2\n\n"); scanf("%d",&choix); if(choix==1){ - printf("Menu Utilisateur"); - //MenuUtilisateur(); + printf("\nMenu Utilisateur"); + MenuUtilisateur(tiut, n); } if(choix==2){ - printf("Menu Administrateur"); + printf("\nMenu Administrateur"); MenuAdministrateur(tiut,n); } } diff --git a/testV1 b/testV1 deleted file mode 100755 index 1ee1887..0000000 Binary files a/testV1 and /dev/null differ diff --git a/testV2 b/testV2 deleted file mode 100644 index 16f7900..0000000 Binary files a/testV2 and /dev/null differ diff --git a/testV3 b/testV3 deleted file mode 100755 index 5421d2e..0000000 Binary files a/testV3 and /dev/null differ diff --git a/utilisateurIut.c b/utilisateurIut.c index 0457fb3..b5ea66d 100644 --- a/utilisateurIut.c +++ b/utilisateurIut.c @@ -3,13 +3,13 @@ #include #include "iut.h" -void MenuUtilisateur(VilleIUT *tiut[],int n){ +void MenuUtilisateur(VilleIUT *tiut[], int n){ int choix, succes; - printf("\n1 - Recherche d'un IUT\n2 - Départements dans chaque IUT\n3 - Nombre de places en première année\n4 - Recherche d'un département\n5 - Quitter"); + printf("\n1 - Recherche d'un IUT\n2 - Départements dans chaque IUT\n3 - Nombre de places en première année\n4 - Recherche d'un département\n5 - Quitter\n"); scanf("%d%*c",&choix); if(choix==1){ //Recherche de tel IUT - succes = rechercheIUT(tiut); + succes = rechercheIUT(tiut, n); } if(choix==2){ //creer departemement @@ -32,15 +32,15 @@ void MenuUtilisateur(VilleIUT *tiut[],int n){ } } -int rechercheIUT(VilleIUT *tiut[]){ +int rechercheIUT(VilleIUT *tiut[], int n){ char rech[31]; + int i; printf("Entrez le nom d'une ville ou d'un IUT : "); scanf("%s", &rech); - if(rech==NULL){ - printf("NOPE"); - exit(1); + for(i=0;iville, rech)==0){ + printf("Trouvé"); + } } - else - printf("Succès"); - return 25; + return 2; }