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,tr,MATR,k=0,n=nmax,a,nbrmatiere=nmax,m=-1,etud=-1,nombre_detudiant,nunite,f=0;
- ///////////////////
- void principale();
- void choix();
- //
- void G_etudiants();
- void N_etudiants();
- void C_etudiants();
- void M_etudiants();
- void S_etudiants();
- //
- void G_matiers();
- void N_matiers();
- void C_matiers();
- void M_matiers();
- void S_matiers();
- //
- 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();
- choix();
- }
- /////////////////////////////////////////////
- void choix()
- {
- switch (c_principale)
- {
- case b1:
- G_etudiants();
- break;
- case b2:
- G_matiers();
- break;
- case b3:
- saisie_de_bulletin_de_notes();
- break;
- case b4:
- edition_de_bulletin_de_notes();
- break;
- case esc:
- return 0;
- break;
- }
- }
- /////////////////////////////////////////////////////////////////////////
- void G_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':etud++;N_etudiants();break;
- case '2':C_etudiants();break;
- case '3':M_etudiants();break;
- case '4':S_etudiants();break;
- case esc: principale(); break;
- }
- }
- /////////////////////////////////////////////////////////////////////////
- void N_etudiants()
- {
- do{
- tr=0;
- printf(" Matricule: ");
- scanf("%d",&etudiant[etud].mat);
- for(j=0;j<n;j++)
- {
- if(etudiant[etud].mat==etudiant[j].mat && etud!=j)
- {
- tr=1;
- j=n;
- }
- }
- }while(tr==1);
- printf("\nNom : ");
- scanf("%s",&etudiant[etud].nom);
- printf("\nPrenom : ");
- scanf("%s",&etudiant[etud].prenom);
- printf("\nClasse : ");
- scanf(" %c",&etudiant[etud].classe);
- printf("\n %s %s a etait ajoute avec succes",etudiant[etud].nom,etudiant[etud].prenom);
- printf(" \n \t----------- \n");
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void C_etudiants()
- {
- do{
- tr=0;
- printf("entrer l' MATR ou 0 pour retourner:");
- scanf("%d",&MATR);
- if(MATR==0)
- {
- principale();
- }
- else{
- for(j=0;j<n;j++)
- {
- if(MATR==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=n;
- tr=1;
- }
- }
- }
- }while(tr==0);
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void M_etudiants()
- {
- tr=0;
- do{
- printf("entrer l' MATR ou 0 pour retourner:");
- scanf("%d",&MATR);
- if(MATR==0)
- {
- principale();
- }
- else{
- for(j=0;j<n;j++)
- {
- if(MATR==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);
- tr=1;j=n;
- }
- }
- }
- }while(tr==0);
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void S_etudiants()
- {
- printf("entrer l' MATR ou 0 pour retourner:");
- scanf("%d",&MATR);
- if(MATR==0)
- {
- principale();
- }
- else{
- for(j=0;j<n;j++)
- {
- if(MATR==etudiant[j].mat)
- {
- for(k=j;k<n-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;
- }
- n--;
- j=n;
- }
- }
- }
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////
- void G_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++;N_matiers();break;
- case '2':C_matiers();break;
- case '3':M_matiers();break;
- case '4':S_matiers();break;
- case esc: principale(); break;
- }
- }
- /////////////////////////////////////////////////////////////////////////
- void N_matiers()
- {
- do{
- tr=0;
- printf("Matricule: ");
- scanf("%d",&matiere[m].codemat);
- for(j=0;j<nbrmatiere;j++)
- {
- if(matiere[m].codemat==matiere[j].codemat && m!=j)
- {
- tr=1;
- j=nbrmatiere;
- }
- }
- }while(tr==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 C_matiers()
- {
- do{
- tr=0;
- printf("entrer l' MATR ou 0 pour retourner:");
- scanf("%d",&MATR);
- if(MATR==0)
- {
- principale();
- }
- else{
- for(j=0;j<nbrmatiere;j++)
- {
- if(MATR==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=nbrmatiere;
- tr=1;
- }
- }
- }
- }while(tr==0);
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void M_matiers()
- {
- do{
- tr=0;
- printf("entrer l' MATR ou 0 pour retourner:");
- scanf("%d",&MATR);
- if(MATR==0)
- {
- principale();
- }
- else{
- for(j=0;j<nbrmatiere;j++)
- {
- if(MATR==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);
- tr=1;j=nbrmatiere;
- }
- }
- }
- }while(tr==0);
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void supprimer_matiere()
- {
- printf("entrer l' MATR ou 0 pour retourner:");
- scanf("%d",&MATR);
- if(MATR==0)
- {
- principale();
- }
- else{
- for(j=0;j<nbrmatiere;j++)
- {
- if(MATR==matiere[j].codemat)
- {
- for(k=j;k<nbrmatiere-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;
- }
- nbrmatiere--;
- j=nbrmatiere;
- }
- }
- }
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void saisie_de_bulletin_de_notes()
- {
- do{tr=0;
- printf("\nentrer la matricule :");
- scanf("%d",&MATR);
- for(j=0;j<n;j++)
- {
- if(MATR==etudiant[j].mat)
- {
- tr=1;
- nombre_detudiant=j;
- j=n;
- }
- }
- }while(tr==0);
- printf("\nla 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++)
- for(k=0;k<=m;k++)
- {
- printf("UNITE DENSEIGNEMENT %c\n",w);
- if(matiere[k].UE==w)
- {
- printf("%s :\t",matiere[k].nommat);
- scanf("%f",&etudiant[nombre_detudiant].note[k]);
- }
- }
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- void edition_de_bulletin_de_notes()
- {
- tr=0;
- do{
- printf("\nentrer la matricule :");
- scanf("%d",&MATR);
- for(j=0;j<n;j++)
- {
- if(MATR==etudiant[j].mat)
- {
- tr=1;
- nombre_detudiant=j;
- j=n;
- }
- }
- }while(tr==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++)
- f=0;
- for(k=0;k<=m;k++)
- {
- if(matiere[k].UE==w)
- {
- if(f=0)
- {
- printf("UNITE DENSEIGNEMENT %c\n",w);
- f=1;
- }
- printf("%s :\t",matiere[k].nommat);
- scanf("%f",&etudiant[nombre_detudiant].note[k]);
- }
- }
- principale();
- }
- /////////////////////////////////////////////////////////////////////////
- int main()
- {
- principale();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement