Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 12.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define esc 27
  4. #define f1 ';'
  5. #define f2 '<'
  6. #define f3 '='
  7. #define f4 '>'
  8. #define b1 49
  9. #define b2 50
  10. #define b3 51
  11. #define b4 52
  12. #define nmax 100
  13.  
  14. char c_principale,c_etudiants,c_matieres,U,w;
  15. int i=0,j=0,tr,MATR,k=0,n=nmax,a,nbrmatiere=nmax,m=-1,etud=-1,nombre_detudiant,nunite,f=0;
  16.  
  17. ///////////////////
  18. void principale();
  19. void choix();
  20. //
  21. void G_etudiants();
  22. void N_etudiants();
  23. void C_etudiants();
  24. void M_etudiants();
  25. void S_etudiants();
  26. //
  27. void G_matiers();
  28. void N_matiers();
  29. void C_matiers();
  30. void M_matiers();
  31. void S_matiers();
  32. //
  33. void saisie_de_bulletin_de_notes();
  34. void edition_de_bulletin_de_notes();
  35. //////////////////////
  36. typedef struct Etudiant Etudiant;
  37. struct Etudiant
  38. {
  39.     int mat;
  40.     char nom[25];
  41.     char prenom[25];
  42.     char classe;
  43.     float note[nmax];
  44. };
  45. typedef struct Matiere Matiere;
  46. struct Matiere
  47. {
  48.     int codemat;
  49.     char nommat[25];
  50.     float coeff;
  51.     char classe;
  52.     char UE;
  53. };
  54. Etudiant etudiant[nmax]={0};
  55. Matiere matiere[nmax]={0};
  56.  
  57. /////////////////////////////////////////////////////////////////////////
  58. void principale()
  59. {
  60.     printf("<1> GESTION DES ETUDIANTS \n");
  61.     printf("<2> GESTION DE MATIERS \n");
  62.     printf("<3> SAISIE DE BULLETINS DE NOTES\n");
  63.     printf("<4> EDITION DE BULLETINs DE NOTES \n");
  64.     printf("<ESC> QUITTER \n");
  65.     printf("\t\t VOTRE CHOIX:\t");
  66.     c_principale=getch();
  67.     choix();
  68.  
  69. }
  70. /////////////////////////////////////////////
  71. void choix()
  72. {
  73.    switch (c_principale)
  74.     {
  75.     case b1:
  76.         G_etudiants();
  77.     break;
  78.  
  79.     case b2:
  80.         G_matiers();
  81.     break;
  82.  
  83.  
  84.     case b3:
  85.         saisie_de_bulletin_de_notes();
  86.     break;
  87.  
  88.  
  89.     case b4:
  90.         edition_de_bulletin_de_notes();
  91.     break;
  92.  
  93.  
  94.     case esc:
  95.     return 0;
  96.     break;
  97.     }
  98. }
  99. /////////////////////////////////////////////////////////////////////////
  100. void G_etudiants()
  101. {
  102.     printf("\n\n\n \t\t GESTION DES ETUDIANTS \n");
  103.     printf("F1:Nouveau\tF2:Consulter\tF3:Modifier\tF4:Supprimer\tESC :Menu \n");
  104.     c_etudiants=getch();
  105.     switch(c_etudiants)
  106.     {
  107.         case '1':etud++;N_etudiants();break;
  108.         case '2':C_etudiants();break;
  109.         case '3':M_etudiants();break;
  110.         case '4':S_etudiants();break;
  111.         case esc: principale(); break;
  112.     }
  113.  
  114. }
  115. /////////////////////////////////////////////////////////////////////////
  116. void N_etudiants()
  117. {
  118.  
  119.     do{
  120.  
  121.     tr=0;
  122.     printf(" Matricule: ");
  123.     scanf("%d",&etudiant[etud].mat);
  124.         for(j=0;j<n;j++)
  125.         {
  126.             if(etudiant[etud].mat==etudiant[j].mat && etud!=j)
  127.             {
  128.                 tr=1;
  129.                 j=n;
  130.  
  131.             }
  132.         }
  133.  
  134.     }while(tr==1);
  135.     printf("\nNom      : ");
  136.     scanf("%s",&etudiant[etud].nom);
  137.     printf("\nPrenom   : ");
  138.     scanf("%s",&etudiant[etud].prenom);
  139.     printf("\nClasse   : ");
  140.     scanf(" %c",&etudiant[etud].classe);
  141.     printf("\n %s %s a etait ajoute avec succes",etudiant[etud].nom,etudiant[etud].prenom);
  142.     printf(" \n \t----------- \n");
  143.     principale();
  144. }
  145. /////////////////////////////////////////////////////////////////////////
  146.  
  147. void C_etudiants()
  148. {
  149.  
  150.     do{
  151.         tr=0;
  152.         printf("entrer l' MATR ou 0 pour retourner:");
  153.         scanf("%d",&MATR);
  154.         if(MATR==0)
  155.         {
  156.             principale();
  157.         }
  158.         else{
  159.                 for(j=0;j<n;j++)
  160.                 {
  161.                     if(MATR==etudiant[j].mat)
  162.                     {
  163.                     printf("Matricule  : %d ",etudiant[j].mat);
  164.                     printf("\nNom      : %s",etudiant[j].nom);
  165.                     printf("\nPrenom   : %s",etudiant[j].prenom);
  166.                     printf("\nClasse   : %c\n",etudiant[j].classe);
  167.                     j=n;
  168.                     tr=1;
  169.                     }
  170.                 }
  171.             }
  172.     }while(tr==0);
  173.     principale();
  174.  
  175. }
  176. /////////////////////////////////////////////////////////////////////////
  177. void M_etudiants()
  178. {
  179.     tr=0;
  180. do{
  181.     printf("entrer l' MATR ou 0 pour retourner:");
  182.     scanf("%d",&MATR);
  183.     if(MATR==0)
  184.     {
  185.     principale();
  186.     }
  187.     else{
  188.         for(j=0;j<n;j++)
  189.         {
  190.             if(MATR==etudiant[j].mat)
  191.             {
  192.             printf("entrer le matricule: ");
  193.             scanf("%d",&etudiant[j].mat);
  194.             printf("\entrer le nom: ");
  195.             scanf("%s",&etudiant[j].nom);
  196.             printf("\entrer le prenom: ");
  197.             scanf("%s",&etudiant[j].prenom);
  198.             printf("\entrer la classe: ");
  199.             scanf(" %c",&etudiant[j].classe);
  200.             tr=1;j=n;
  201.             }
  202.         }
  203.     }
  204. }while(tr==0);
  205. principale();
  206. }
  207. /////////////////////////////////////////////////////////////////////////
  208. void S_etudiants()
  209. {
  210. printf("entrer l' MATR ou 0 pour retourner:");
  211.     scanf("%d",&MATR);
  212.     if(MATR==0)
  213.     {
  214.     principale();
  215.     }
  216.     else{
  217.         for(j=0;j<n;j++)
  218.         {
  219.             if(MATR==etudiant[j].mat)
  220.             {
  221.                 for(k=j;k<n-1;k++)
  222.                {
  223.                     for(a=0;a<25;a++)
  224.                     {
  225.                         etudiant[k].nom[a]=etudiant[k+1].nom[a];
  226.                         etudiant[k].prenom[a]=etudiant[k+1].prenom[a];
  227.                     }
  228.                 etudiant[k].mat=etudiant[k+1].mat;
  229.                 etudiant[k].classe=etudiant[k+1].classe;
  230.  
  231.                }
  232.                 n--;
  233.                 j=n;
  234.             }
  235.         }
  236.     }
  237.     principale();
  238.  
  239. }
  240. /////////////////////////////////////////////////////////////////////////
  241. /////////////////////////////////////////////////////////////////////////
  242. /////////////////////////////////////////////////////////////////////////
  243. void G_matiers()
  244. {
  245.     printf("\n\n\n \t\t GESTION DES MATIERS \n");
  246.     printf("F1:Nouveau\tF2:Consulter\tF3:Modifier\tF4:Supprimer\tESC :Menu \n");
  247.     c_matieres=getch();
  248.         switch(c_matieres)
  249.         {
  250.             case '1':m++;N_matiers();break;
  251.             case '2':C_matiers();break;
  252.             case '3':M_matiers();break;
  253.             case '4':S_matiers();break;
  254.             case esc: principale(); break;
  255.         }
  256.  
  257. }
  258. /////////////////////////////////////////////////////////////////////////
  259. void N_matiers()
  260. {
  261.     do{
  262.     tr=0;
  263.     printf("Matricule: ");
  264.     scanf("%d",&matiere[m].codemat);
  265.         for(j=0;j<nbrmatiere;j++)
  266.         {
  267.             if(matiere[m].codemat==matiere[j].codemat && m!=j)
  268.             {
  269.                 tr=1;
  270.                 j=nbrmatiere;
  271.  
  272.             }
  273.         }
  274.     }while(tr==1);
  275.     printf("\nNom      : ");
  276.     scanf("%s",&matiere[m].nommat);
  277.     printf("\ncoefficient   : ");
  278.     scanf("%s",&matiere[m].coeff);
  279.     printf("\nClasse   : ");
  280.     scanf(" %c",&matiere[m].classe);
  281.     printf("\nUnite denseignement   : ");
  282.     scanf(" %c",&matiere[m].UE);
  283.     printf("\n %s a etait ajoute avec succes",matiere[m].nommat);
  284.     printf(" \n \t----------- \n");
  285.     principale();
  286. }
  287. /////////////////////////////////////////////////////////////////////////
  288. void C_matiers()
  289. {
  290. do{
  291.         tr=0;
  292.         printf("entrer l' MATR ou 0 pour retourner:");
  293.         scanf("%d",&MATR);
  294.         if(MATR==0)
  295.         {
  296.             principale();
  297.         }
  298.         else{
  299.                 for(j=0;j<nbrmatiere;j++)
  300.                 {
  301.                     if(MATR==matiere[j].codemat)
  302.                     {
  303.                     printf("Matricule  : %d ",matiere[j].codemat);
  304.                     printf("\nNom      : %s",matiere[j].nommat);
  305.                     printf("\nPrenom   : %s",matiere[j].coeff);
  306.                     printf("\nClasse   : %c",matiere[j].classe);
  307.                     j=nbrmatiere;
  308.                     tr=1;
  309.                     }
  310.                 }
  311.             }
  312.     }while(tr==0);
  313.     principale();
  314. }
  315. /////////////////////////////////////////////////////////////////////////
  316. void M_matiers()
  317. {
  318.  
  319. do{
  320.     tr=0;
  321.     printf("entrer l' MATR ou 0 pour retourner:");
  322.     scanf("%d",&MATR);
  323.     if(MATR==0)
  324.     {
  325.     principale();
  326.     }
  327.     else{
  328.         for(j=0;j<nbrmatiere;j++)
  329.         {
  330.             if(MATR==matiere[j].codemat)
  331.             {
  332.             printf("entrer le nouveau matricule: ");
  333.             scanf("%d",&matiere[j].codemat);
  334.             printf("\entrer le nom: ");
  335.             scanf("%s",&matiere[j].nommat);
  336.             printf("\entrer le coefficient: ");
  337.             scanf("%s",&matiere[j].coeff);
  338.             printf("\entrer la classe: ");
  339.             scanf(" %c",&matiere[j].classe);
  340.             tr=1;j=nbrmatiere;
  341.             }
  342.         }
  343.     }
  344. }while(tr==0);
  345. principale();
  346. }
  347. /////////////////////////////////////////////////////////////////////////
  348. void supprimer_matiere()
  349. {
  350. printf("entrer l' MATR ou 0 pour retourner:");
  351.     scanf("%d",&MATR);
  352.     if(MATR==0)
  353.     {
  354.     principale();
  355.     }
  356.     else{
  357.         for(j=0;j<nbrmatiere;j++)
  358.         {
  359.             if(MATR==matiere[j].codemat)
  360.             {
  361.                 for(k=j;k<nbrmatiere-1;k++)
  362.                {
  363.                     for(a=0;a<25;a++)
  364.                     {
  365.                         matiere[k].nommat[a]=matiere[k+1].nommat[a];
  366.                     }
  367.                 matiere[k].codemat=matiere[k+1].codemat;
  368.                 matiere[k].coeff=matiere[k+1].coeff;
  369.                 matiere[k].classe=matiere[k+1].classe;
  370.                }
  371.                 nbrmatiere--;
  372.                 j=nbrmatiere;
  373.             }
  374.         }
  375.     }
  376.     principale();
  377. }
  378. /////////////////////////////////////////////////////////////////////////
  379. void saisie_de_bulletin_de_notes()
  380. {
  381.  
  382.         do{tr=0;
  383.             printf("\nentrer la matricule :");
  384.             scanf("%d",&MATR);
  385.             for(j=0;j<n;j++)
  386.             {
  387.                 if(MATR==etudiant[j].mat)
  388.                 {
  389.                     tr=1;
  390.                     nombre_detudiant=j;
  391.                     j=n;
  392.                 }
  393.             }
  394.           }while(tr==0);
  395.           printf("\nla matricule :%d",etudiant[nombre_detudiant].mat);
  396.           printf("\nle nom :");
  397.           for(j=0;j<25;j++)
  398.           {
  399.               printf("%c",etudiant[nombre_detudiant].nom[j]);
  400.           }
  401.             printf("\nle prenom :");
  402.           for(j=0;j<25;j++)
  403.           {
  404.             printf("%c",etudiant[nombre_detudiant].prenom[j]);
  405.           }
  406.  
  407.           printf("\nla classe :%c\n\n",etudiant[nombre_detudiant].classe);
  408.  
  409.  
  410.  
  411.                 printf("\n matiere \t notes \n");
  412. for(w='A';w<'z';w++)
  413.                 for(k=0;k<=m;k++)
  414.                 {
  415.                     printf("UNITE DENSEIGNEMENT %c\n",w);
  416.                     if(matiere[k].UE==w)
  417.                     {
  418.                     printf("%s :\t",matiere[k].nommat);
  419.                     scanf("%f",&etudiant[nombre_detudiant].note[k]);
  420.                     }
  421.                 }
  422.  
  423.                 principale();
  424.  
  425.  
  426. }
  427.  
  428. /////////////////////////////////////////////////////////////////////////
  429. void edition_de_bulletin_de_notes()
  430. {
  431. tr=0;
  432.         do{
  433.             printf("\nentrer la matricule :");
  434.             scanf("%d",&MATR);
  435.             for(j=0;j<n;j++)
  436.             {
  437.                 if(MATR==etudiant[j].mat)
  438.                 {
  439.                     tr=1;
  440.                     nombre_detudiant=j;
  441.                     j=n;
  442.                 }
  443.             }
  444.           }while(tr==0);
  445.           printf("\nle matricule :%d",etudiant[nombre_detudiant].mat);
  446.           printf("\nle nom :");
  447.           for(j=0;j<25;j++)
  448.           {
  449.               printf("%c",etudiant[nombre_detudiant].nom[j]);
  450.           }
  451.             printf("\nle prenom :");
  452.           for(j=0;j<25;j++)
  453.           {
  454.             printf("%c",etudiant[nombre_detudiant].prenom[j]);
  455.           }
  456.  
  457.           printf("\nla classe :%c\n\n",etudiant[nombre_detudiant].classe);
  458.  
  459.  
  460.  
  461.                 printf("\n matiere \t notes \n");
  462. for(w='A';w<='Z';w++)
  463. f=0;
  464.                 for(k=0;k<=m;k++)
  465.                 {
  466.  
  467.                     if(matiere[k].UE==w)
  468.                     {
  469.                         if(f=0)
  470.                         {
  471.                             printf("UNITE DENSEIGNEMENT %c\n",w);
  472.                             f=1;
  473.                         }
  474.  
  475.                     printf("%s :\t",matiere[k].nommat);
  476.                     scanf("%f",&etudiant[nombre_detudiant].note[k]);
  477.                     }
  478.                 }
  479. principale();
  480. }
  481.  
  482. /////////////////////////////////////////////////////////////////////////
  483. int main()
  484. {
  485.  
  486. principale();
  487.  
  488.  
  489.     return 0;
  490. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement