Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct PV
  6. {
  7. char Nom[20];
  8. char Prenom[10];
  9. int Matricule;
  10. float Module[5];
  11. float Coeff[6];
  12. float Credit;
  13. bool Admission;
  14. float MoyGLE;
  15. }Etudiant;
  16.  
  17. int main()
  18. {
  19.  
  20. int N;
  21.  
  22. cout << "Quel est le nombre d'étudiants ?\n";
  23. cin >> N;
  24.  
  25. N = N+1; //Car ‡a commence … l'‚tudiant 0, et c'est moche.
  26.  
  27. PV Etudiant[N];
  28.  
  29. int Matricule;
  30.  
  31. for (int nb=1;nb<N;nb++)
  32.  
  33. {
  34. cout<<"------- PROCESSUS D'AJOUT DES PV ---- ETUDIANT " << nb << "\n\n";
  35.  
  36. cout<<"Nom de l'‚tudiant :\n";
  37. cin>>Etudiant[nb].Nom;
  38.  
  39. cout<<"Pr‚nom de l'‚tudiant :\n";
  40. cin>>Etudiant[nb].Prenom;
  41.  
  42. cout<<"Matricule de l'‚tudiant :\n";
  43. cin>>Etudiant[nb].Matricule;
  44.  
  45. cout<<"Moyenne des modules:\n";
  46.  
  47. for(int i=1;i<6;i++)
  48. {
  49. cout<<"Module "<< i <<" :\n";
  50. cin>>Etudiant[nb].Module[i];
  51. }
  52.  
  53. cout<<"\nCoefficient des modules:\n";
  54.  
  55. for(int j=1;j<6;j++)
  56. {
  57. cout<<"Coefficient "<< j <<" :\n";
  58. cin>>Etudiant[nb].Coeff[j];
  59. }
  60. }
  61.  
  62. for (int nb=1;nb<N;nb++)
  63. {
  64. for (int i=1;i<6;i++)
  65. {
  66. if (Etudiant[nb].Module[i]>10.00)
  67. {
  68. Etudiant[nb].Credit=Etudiant[nb].Credit+(Etudiant[nb].Coeff[i])*10;
  69. }
  70. else
  71. {
  72. Etudiant[nb].Credit=0;
  73. }
  74. }
  75. }
  76.  
  77. // ADMIS OR NOT ? //
  78.  
  79. for (int nb=1;nb<N;nb++)
  80. {
  81. for (int i=1;i<6;i++)
  82. {
  83. Etudiant[nb].MoyGLE = Etudiant[nb].MoyGLE + Etudiant[nb].Module[i];
  84. }
  85. if(Etudiant[nb].MoyGLE>10.00 || Etudiant[nb].Credit>190)
  86. {
  87. Etudiant[nb].Admission=1;
  88. }
  89. else
  90. {
  91. Etudiant[nb].Admission=0;
  92. }
  93. }
  94.  
  95.  
  96. for (int nb=1;nb<N;nb++)
  97. {
  98. if (Etudiant[nb].Admission==1)
  99. {
  100. cout << "L'‚tudiant " << Etudiant[nb].Nom << " " << Etudiant[nb].Prenom << " est admis.\n";
  101. }
  102. else
  103. {
  104. cout << "L'‚tudiant " << Etudiant[nb].Nom << " " << Etudiant[nb].Prenom << " est ajourn‚.\n";
  105.  
  106. }
  107. }
  108.  
  109. cout << "Rechercher si un ‚tudiant est admis ou ajourn‚ grƒce … son matricule, entrez-le : \n";
  110. cin >> Matricule;
  111.  
  112. for (int nb=1;nb<N;nb++)
  113. {
  114. if(Etudiant[nb].Matricule == Matricule)
  115. if (Etudiant[nb].Admission==1)
  116. {
  117. cout << "\nL'‚tudiant avec le matricule " << Matricule << " s'appelle " << Etudiant[nb].Nom << " " << Etudiant[nb].Prenom << " et est admis.\n";
  118. }
  119. else
  120. {
  121. cout << "\nL'‚tudiant avec le matricule " << Matricule << " s'appelle " << Etudiant[nb].Nom << " " << Etudiant[nb].Prenom << " et est ajourn‚.\n";
  122.  
  123. }
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement