Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 11.29 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,existe,ID,k=0,ne=nmax,a,nm=nmax,m=-1,e=-1,nombre_detudiant,nbrunite,fois=0;
  16.  
  17. ///////////////////
  18. void principale();
  19. void leschoix();
  20. //
  21. void gestion_des_etudiants();
  22. void nouveau_etudiant();
  23. void consulter_etudiant();
  24. void modifier_etudiant();
  25. void supprimer_etudiant();
  26. //
  27. void gestion_des_matiers();
  28. void nouveau_matiere();
  29. void consulter_matiere();
  30. void modifier_matiere();
  31. void supprimer_matiere();
  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.     leschoix();
  68.  
  69. }
  70. /////////////////////////////////////////////
  71. void leschoix()
  72. {
  73.    switch (c_principale)
  74.     {
  75.     case b1:
  76.         gestion_des_etudiants();
  77.     break;
  78.  
  79.     case b2:
  80.         gestion_des_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 gestion_des_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':e++;nouveau_etudiant();break;
  108.         case '2':consulter_etudiant();break;
  109.         case '3':modifier_etudiant();break;
  110.         case '4':supprimer_etudiant();break;
  111.         case esc: principale(); break;
  112.     }
  113.  
  114. }
  115. /////////////////////////////////////////////////////////////////////////
  116. void nouveau_etudiant()
  117. {
  118.  
  119.     do{
  120.  
  121.     existe=0;
  122.     printf(" Matricule: ");
  123.     scanf("%d",&etudiant[e].mat);
  124.         for(j=0;j<ne;j++)
  125.         {
  126.             if(etudiant[e].mat==etudiant[j].mat && e!=j)
  127.             {
  128.                 existe=1;
  129.                 j=ne;
  130.  
  131.             }
  132.         }
  133.  
  134.     }while(existe==1);
  135.     printf("\nNom      : ");
  136.     scanf("%s",&etudiant[e].nom);
  137.     printf("\nPrenom   : ");
  138.     scanf("%s",&etudiant[e].prenom);
  139.     printf("\nClasse   : ");
  140.     scanf(" %c",&etudiant[e].classe);
  141.     printf("\n %s %s a etait ajoute avec succes",etudiant[e].nom,etudiant[e].prenom);
  142.     printf(" \n \t----------- \n");
  143.     principale();
  144. }
  145. /////////////////////////////////////////////////////////////////////////
  146.  
  147. void consulter_etudiant()
  148. {
  149.  
  150.     do{
  151.         existe=0;
  152.         printf("entrer l' ID ou 0 pour retourner:");
  153.         scanf("%d",&ID);
  154.         if(ID==0)
  155.         {
  156.             principale();
  157.         }
  158.         else{
  159.                 for(j=0;j<ne;j++)
  160.                 {
  161.                     if(ID==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=ne;
  168.                     existe=1;
  169.                     }
  170.                 }
  171.             }
  172.     }while(existe==0);
  173.     principale();
  174.  
  175. }
  176. /////////////////////////////////////////////////////////////////////////
  177. void modifier_etudiant()
  178. {
  179.     existe=0;
  180. do{
  181.     printf("entrer l' ID ou 0 pour retourner:");
  182.     scanf("%d",&ID);
  183.     if(ID==0)
  184.     {
  185.     principale();
  186.     }
  187.     else{
  188.         for(j=0;j<ne;j++)
  189.         {
  190.             if(ID==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.             existe=1;j=ne;
  201.             }
  202.         }
  203.     }
  204. }while(existe==0);
  205. principale();
  206. }
  207. /////////////////////////////////////////////////////////////////////////
  208. void supprimer_etudiant()
  209. {
  210. printf("entrer l' ID ou 0 pour retourner:");
  211.     scanf("%d",&ID);
  212.     if(ID==0)
  213.     {
  214.     principale();
  215.     }
  216.     else{
  217.         for(j=0;j<ne;j++)
  218.         {
  219.             if(ID==etudiant[j].mat)
  220.             {
  221.                 for(k=j;k<ne-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.                 ne--;
  233.                 j=ne;
  234.             }
  235.         }
  236.     }
  237.     principale();
  238.  
  239. }
  240. /////////////////////////////////////////////////////////////////////////
  241. /////////////////////////////////////////////////////////////////////////
  242. /////////////////////////////////////////////////////////////////////////
  243. void gestion_des_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++;nouveau_matiere();break;
  251.             case '2':consulter_matiere();break;
  252.             case '3':modifier_matiere();break;
  253.             case '4':supprimer_matiere();break;
  254.             case esc: principale(); break;
  255.         }
  256.  
  257. }
  258. /////////////////////////////////////////////////////////////////////////
  259. void nouveau_matiere()
  260. {
  261.     do{
  262.     existe=0;
  263.     printf("Matricule: ");
  264.     scanf("%d",&matiere[m].codemat);
  265.         for(j=0;j<nm;j++)
  266.         {
  267.             if(matiere[m].codemat==matiere[j].codemat && m!=j)
  268.             {
  269.                 existe=1;
  270.                 j=nm;
  271.  
  272.             }
  273.         }
  274.     }while(existe==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 consulter_matiere()
  289. {
  290. do{
  291.         existe=0;
  292.         printf("entrer l' ID ou 0 pour retourner:");
  293.         scanf("%d",&ID);
  294.         if(ID==0)
  295.         {
  296.             principale();
  297.         }
  298.         else{
  299.                 for(j=0;j<nm;j++)
  300.                 {
  301.                     if(ID==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=nm;
  308.                     existe=1;
  309.                     }
  310.                 }
  311.             }
  312.     }while(existe==0);
  313.     principale();
  314. }
  315. /////////////////////////////////////////////////////////////////////////
  316. void modifier_matiere()
  317. {
  318.  
  319. do{
  320.     existe=0;
  321.     printf("entrer l' ID ou 0 pour retourner:");
  322.     scanf("%d",&ID);
  323.     if(ID==0)
  324.     {
  325.     principale();
  326.     }
  327.     else{
  328.         for(j=0;j<nm;j++)
  329.         {
  330.             if(ID==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.             existe=1;j=nm;
  341.             }
  342.         }
  343.     }
  344. }while(existe==0);
  345. principale();
  346. }
  347. /////////////////////////////////////////////////////////////////////////
  348. void supprimer_matiere()
  349. {
  350. printf("entrer l' ID ou 0 pour retourner:");
  351.     scanf("%d",&ID);
  352.     if(ID==0)
  353.     {
  354.     principale();
  355.     }
  356.     else{
  357.         for(j=0;j<nm;j++)
  358.         {
  359.             if(ID==matiere[j].codemat)
  360.             {
  361.                 for(k=j;k<nm-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.                 nm--;
  372.                 j=nm;
  373.             }
  374.         }
  375.     }
  376.     principale();
  377. }
  378. /////////////////////////////////////////////////////////////////////////
  379. void saisie_de_bulletin_de_notes()
  380. {
  381.  
  382.         existe=0;
  383.         do{
  384.             printf("\nentrer la matricule :");
  385.             scanf("%d",&ID);
  386.             for(j=0;j<ne;j++)
  387.             {
  388.                 if(ID==etudiant[j].mat)
  389.                 {
  390.                     existe=1;
  391.                     nombre_detudiant=j;
  392.                     j=ne;
  393.                 }
  394.             }
  395.           }while(existe==0);
  396.           printf("\nle matricule :%d",etudiant[nombre_detudiant].mat);
  397.           printf("\nle nom :");
  398.           for(j=0;j<25;j++)
  399.           {
  400.               printf("%c",etudiant[nombre_detudiant].nom[j]);
  401.           }
  402.             printf("\nle prenom :");
  403.           for(j=0;j<25;j++)
  404.           {
  405.             printf("%c",etudiant[nombre_detudiant].prenom[j]);
  406.           }
  407.  
  408.           printf("\nla classe :%c\n\n",etudiant[nombre_detudiant].classe);
  409.  
  410.  
  411.  
  412.                 printf("\n matiere \t notes \n");
  413. for(w='A';w<='Z';w++)
  414. {fois=0;
  415.                 for(k=0;k<=m;k++)
  416.                 {
  417.  
  418.                     if(matiere[k].UE==w)
  419.                     {
  420.                         if(fois=0)
  421.                         {
  422.                             printf("UNITE DENSEIGNEMENT %c\n",w);
  423.                             fois=1;
  424.                         }
  425.  
  426.                     printf("%s :\t",matiere[k].nommat);
  427.                     scanf("%f",&etudiant[nombre_detudiant].note[k]);
  428.                     }
  429.                 }
  430. }
  431. principale();
  432.  
  433.  
  434. }
  435.  
  436. /////////////////////////////////////////////////////////////////////////
  437. void edition_de_bulletin_de_notes()
  438. {
  439.  
  440. }
  441.  
  442. /////////////////////////////////////////////////////////////////////////
  443. int main()
  444. {
  445.  
  446. principale();
  447.  
  448.  
  449.     return 0;
  450. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement