Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define esc 27
- #define f1 ';'
- #define f2 '<'
- #define f3 '='
- #define f4 '>'
- #define b1 49
- #define b2 50
- #define b3 51
- #define b4 52
- #define nmax 100
- char c_principale,c_etudiants,c_matieres,U,w;
- int i=0,j=0,existe,ID,k=0,ne=nmax,a,nm=nmax,m=-1,e=-1,nombre_detudiant,nbrunite,fois=0;
- ///////////////////
- void principale();
- void leschoix();
- //
- void gestion_des_etudiants();
- void nouveau_etudiant();
- void consulter_etudiant();
- void modifier_etudiant();
- void supprimer_etudiant();
- //
- void gestion_des_matiers();
- void nouveau_matiere();
- void consulter_matiere();
- void modifier_matiere();
- void supprimer_matiere();
- //
- void saisie_de_bulletin_de_notes();
- void edition_de_bulletin_de_notes();
- //////////////////////
- typedef struct Etudiant Etudiant;
- struct Etudiant
- {
- int mat;
- char nom[25];
- char prenom[25];
- char classe;
- float note[nmax];
- };
- typedef struct Matiere Matiere;
- struct Matiere
- {
- int codemat;
- char nommat[25];
- float coeff;
- char classe;
- char UE;
- };
- Etudiant etudiant[nmax]={0};
- Matiere matiere[nmax]={0};
- /////////////////////////////////////////////////////////////////////////
- void principale()
- {
- printf("<1> GESTION DES ETUDIANTS \n");
- printf("<2> GESTION DE MATIERS \n");
- printf("<3> SAISIE DE BULLETINS DE NOTES\n");
- printf("<4> EDITION DE BULLETINs DE NOTES \n");
- printf("<ESC> QUITTER \n");
- printf("\t\t VOTRE CHOIX:\t");
- c_principale=getch();
- leschoix();
- }
- /////////////////////////////////////////////
- void leschoix()
- {
- switch (c_principale)
- {
- case b1:
- gestion_des_etudiants();
- break;
- case b2:
- gestion_des_matiers();
- break;
- case b3:
- saisie_de_bulletin_de_notes();
- break;
- case b4:
- edition_de_bulletin_de_notes();
- break;
- case esc:
- return 0;
- break;
- }
- }
- /////////////////////////////////////////////////////////////////////////
- void gestion_des_etudiants()
- {
- printf("\n\n\n \t\t GESTION DES ETUDIANTS \n");
- printf("F1:Nouveau\tF2:Consulter\tF3:Modifier\tF4:Supprimer\tESC :Menu \n");
- c_etudiants=getch();
- switch(c_etudiants)
- {
- case '1':e++;nouveau_etudiant();break;
- case '2':consulter_etudiant();break;
- case '3':modifier_etudiant();break;
- case '4':supprimer_etudiant();break;
- case esc: principale(); break;
- }
- }
- /////////////////////////////////////////////////////////////////////////
- void nouveau_etudiant()
- {
- do{
- existe=0;
- printf(" Matricule: ");
- scanf("%d",&etudiant[e].mat);
- for(j=0;j<ne;j++)
- {
- if(etudiant[e].mat==etudiant[j].mat && e!=j)
- {
- existe=1;
- j=ne;
- }
- }
- }while(existe==1);
- printf("\nNom : ");
- scanf("%s",&etudiant[e].nom);
- printf("\nPrenom : ");
- scanf("%s",&etudiant[e].prenom);
- printf("\nClasse : ");
- scanf(" %c",&etudiant[e].classe);
- printf("\n %s %s a etait ajoute avec succes",etudiant[e].nom,etudiant[e].prenom);
- printf(" \n \t----------- \n");
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void consulter_etudiant()
- {
- do{
- existe=0;
- printf("entrer l' ID ou 0 pour retourner:");
- scanf("%d",&ID);
- if(ID==0)
- {
- principale();
- }
- else{
- for(j=0;j<ne;j++)
- {
- if(ID==etudiant[j].mat)
- {
- printf("Matricule : %d ",etudiant[j].mat);
- printf("\nNom : %s",etudiant[j].nom);
- printf("\nPrenom : %s",etudiant[j].prenom);
- printf("\nClasse : %c\n",etudiant[j].classe);
- j=ne;
- existe=1;
- }
- }
- }
- }while(existe==0);
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void modifier_etudiant()
- {
- existe=0;
- do{
- printf("entrer l' ID ou 0 pour retourner:");
- scanf("%d",&ID);
- if(ID==0)
- {
- principale();
- }
- else{
- for(j=0;j<ne;j++)
- {
- if(ID==etudiant[j].mat)
- {
- printf("entrer le matricule: ");
- scanf("%d",&etudiant[j].mat);
- printf("\entrer le nom: ");
- scanf("%s",&etudiant[j].nom);
- printf("\entrer le prenom: ");
- scanf("%s",&etudiant[j].prenom);
- printf("\entrer la classe: ");
- scanf(" %c",&etudiant[j].classe);
- existe=1;j=ne;
- }
- }
- }
- }while(existe==0);
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void supprimer_etudiant()
- {
- printf("entrer l' ID ou 0 pour retourner:");
- scanf("%d",&ID);
- if(ID==0)
- {
- principale();
- }
- else{
- for(j=0;j<ne;j++)
- {
- if(ID==etudiant[j].mat)
- {
- for(k=j;k<ne-1;k++)
- {
- for(a=0;a<25;a++)
- {
- etudiant[k].nom[a]=etudiant[k+1].nom[a];
- etudiant[k].prenom[a]=etudiant[k+1].prenom[a];
- }
- etudiant[k].mat=etudiant[k+1].mat;
- etudiant[k].classe=etudiant[k+1].classe;
- }
- ne--;
- j=ne;
- }
- }
- }
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
- void gestion_des_matiers()
- {
- printf("\n\n\n \t\t GESTION DES MATIERS \n");
- printf("F1:Nouveau\tF2:Consulter\tF3:Modifier\tF4:Supprimer\tESC :Menu \n");
- c_matieres=getch();
- switch(c_matieres)
- {
- case '1':m++;nouveau_matiere();break;
- case '2':consulter_matiere();break;
- case '3':modifier_matiere();break;
- case '4':supprimer_matiere();break;
- case esc: principale(); break;
- }
- }
- /////////////////////////////////////////////////////////////////////////
- void nouveau_matiere()
- {
- do{
- existe=0;
- printf("Matricule: ");
- scanf("%d",&matiere[m].codemat);
- for(j=0;j<nm;j++)
- {
- if(matiere[m].codemat==matiere[j].codemat && m!=j)
- {
- existe=1;
- j=nm;
- }
- }
- }while(existe==1);
- printf("\nNom : ");
- scanf("%s",&matiere[m].nommat);
- printf("\ncoefficient : ");
- scanf("%s",&matiere[m].coeff);
- printf("\nClasse : ");
- scanf(" %c",&matiere[m].classe);
- printf("\nUnite denseignement : ");
- scanf(" %c",&matiere[m].UE);
- printf("\n %s a etait ajoute avec succes",matiere[m].nommat);
- printf(" \n \t----------- \n");
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void consulter_matiere()
- {
- do{
- existe=0;
- printf("entrer l' ID ou 0 pour retourner:");
- scanf("%d",&ID);
- if(ID==0)
- {
- principale();
- }
- else{
- for(j=0;j<nm;j++)
- {
- if(ID==matiere[j].codemat)
- {
- printf("Matricule : %d ",matiere[j].codemat);
- printf("\nNom : %s",matiere[j].nommat);
- printf("\nPrenom : %s",matiere[j].coeff);
- printf("\nClasse : %c",matiere[j].classe);
- j=nm;
- existe=1;
- }
- }
- }
- }while(existe==0);
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void modifier_matiere()
- {
- do{
- existe=0;
- printf("entrer l' ID ou 0 pour retourner:");
- scanf("%d",&ID);
- if(ID==0)
- {
- principale();
- }
- else{
- for(j=0;j<nm;j++)
- {
- if(ID==matiere[j].codemat)
- {
- printf("entrer le nouveau matricule: ");
- scanf("%d",&matiere[j].codemat);
- printf("\entrer le nom: ");
- scanf("%s",&matiere[j].nommat);
- printf("\entrer le coefficient: ");
- scanf("%s",&matiere[j].coeff);
- printf("\entrer la classe: ");
- scanf(" %c",&matiere[j].classe);
- existe=1;j=nm;
- }
- }
- }
- }while(existe==0);
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void supprimer_matiere()
- {
- printf("entrer l' ID ou 0 pour retourner:");
- scanf("%d",&ID);
- if(ID==0)
- {
- principale();
- }
- else{
- for(j=0;j<nm;j++)
- {
- if(ID==matiere[j].codemat)
- {
- for(k=j;k<nm-1;k++)
- {
- for(a=0;a<25;a++)
- {
- matiere[k].nommat[a]=matiere[k+1].nommat[a];
- }
- matiere[k].codemat=matiere[k+1].codemat;
- matiere[k].coeff=matiere[k+1].coeff;
- matiere[k].classe=matiere[k+1].classe;
- }
- nm--;
- j=nm;
- }
- }
- }
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void saisie_de_bulletin_de_notes()
- {
- existe=0;
- do{
- printf("\nentrer la matricule :");
- scanf("%d",&ID);
- for(j=0;j<ne;j++)
- {
- if(ID==etudiant[j].mat)
- {
- existe=1;
- nombre_detudiant=j;
- j=ne;
- }
- }
- }while(existe==0);
- printf("\nle matricule :%d",etudiant[nombre_detudiant].mat);
- printf("\nle nom :");
- for(j=0;j<25;j++)
- {
- printf("%c",etudiant[nombre_detudiant].nom[j]);
- }
- printf("\nle prenom :");
- for(j=0;j<25;j++)
- {
- printf("%c",etudiant[nombre_detudiant].prenom[j]);
- }
- printf("\nla classe :%c\n\n",etudiant[nombre_detudiant].classe);
- printf("\n matiere \t notes \n");
- for(w='A';w<='Z';w++)
- {fois=0;
- for(k=0;k<=m;k++)
- {
- if(matiere[k].UE==w)
- {
- if(fois=0)
- {
- printf("UNITE DENSEIGNEMENT %c\n",w);
- fois=1;
- }
- printf("%s :\t",matiere[k].nommat);
- scanf("%f",&etudiant[nombre_detudiant].note[k]);
- }
- }
- }
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void edition_de_bulletin_de_notes()
- {
- }
- /////////////////////////////////////////////////////////////////////////
- int main()
- {
- principale();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement