Advertisement
Sunt_tare

Clase Catalog

Oct 18th, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. const int CMAX = 15;
  7.  
  8. class Student{
  9. private:
  10. string nume;
  11. string prenume;
  12. int nota1;
  13. int nota2;
  14. int nota3;
  15. int nota4;
  16. int nota5;
  17.  
  18. double calcMedie(){
  19. return double(nota1+nota2+nota3+nota4+nota5)/5;
  20. }
  21. int esteIntegralist(){
  22. if(nota1>5&&nota2>5&&nota3>5&&nota4>5&&nota5>5)
  23. return 1;
  24. return 0;
  25. }
  26.  
  27. public:
  28. Student(string nume,string prenume,int nota1, int nota2, int nota3, int nota4, int nota5){
  29. this->nume = nume;
  30. this->prenume = prenume;
  31. this->nota1 = nota1;
  32. this->nota2 = nota2;
  33. this->nota3 = nota3;
  34. this->nota4 = nota4;
  35. this->nota5 = nota5;
  36. }
  37. Student(): nume(), prenume(), nota1(0), nota2(0), nota3(0), nota4(0), nota5(0){
  38. }
  39.  
  40. int areBursaMerit(){
  41. if(esteIntegralist()==1&&calcMedie()>=8&&calcMedie()<=9.80)
  42. return 1;
  43. return 0;
  44. }
  45.  
  46. int areBursaPerformanta(){
  47. if(esteIntegralist()==1&&calcMedie()>=9.80)
  48. return 1;
  49. return 0;
  50. }
  51. };
  52.  
  53. //struct catalog{
  54. // string nume[2];
  55. // int note[6];
  56. //}studenti[65540];
  57.  
  58. int main(){
  59. string nume[2];
  60. int note[6];
  61. int n;
  62. int merit = 0, performanta = 0;
  63. float medie, suma;
  64. cin >> n;
  65. for(int i=1;i<=n;i++)
  66. {
  67. suma = 0;
  68. cin >> nume[0] >> nume[1] >> note[0] >> note[1] >> note[2] >> note[3] >> note[4];
  69. //Student(nume[0],nume[1],note[0],note[1],note[2],note[3],note[4]);
  70. if(Student(nume[0],nume[1],note[0],note[1],note[2],note[3],note[4]).areBursaPerformanta()==1){
  71. //cout << nume[0] << " " << nume[1] << " are bursa de merit" << '\n';
  72. merit++;
  73. }
  74. else if(Student(nume[0],nume[1],note[0],note[1],note[2],note[3],note[4]).areBursaMerit()==1){
  75. performanta++;
  76. //cout << nume[0] << " " << nume[1] << " are bursa de performanta" << '\n';
  77. }
  78. }
  79. cout << merit << " " << performanta;
  80. }
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement