levimoosky

Untitled

May 21st, 2015
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct Hallgato
  6. {
  7.     int R; // összpontszám
  8.     int Cs1; // 1. csoport zárthelyi
  9.     int Cs2; // 2. csoport zárthelyi
  10.     int Ef; // évfolyam zárthelyi
  11.     int Gy; // gyakorlati jegy
  12. };
  13.  
  14. int main()
  15. {
  16. //    cout << "hallgatok szama: ";
  17.     int n;
  18.     cin >> n;
  19.  
  20.     Hallgato h[n];
  21.     for(int i=0; i<n; ++i)
  22.     {
  23. //        cout << i+1 << ". hallgato osz: "; cin >> h[i].R;
  24. //        cout << i+1 << ". hallgato 1. cs zh: ";cin >> h[i].Cs1;
  25. //        cout << i+1 << ". hallgato 2. cs zh: "; cin >> h[i].Cs2;
  26. //        cout << i+1 << ". hallgato e zh: "; cin >> h[i].Ef;
  27.         cin >> h[i].R >> h[i].Cs1 >> h[i].Cs2 >> h[i].Ef;
  28.         if(h[i].R<10)
  29.             h[i].Gy = 1;
  30.         else
  31.             h[i].Gy = ((h[i].Cs1+h[i].Cs2+(2*h[i].Ef))/4+0,5);
  32.     }
  33.  
  34. //    for(int i=0; i<n; ++i)
  35. //    {
  36. //        cout << h[i].R << " " << h[i].Cs1 << " " << h[i].Cs2 << " " << h[i].Ef << " " << h[i].Gy << endl;
  37. //    }
  38.  
  39. // elso feladat
  40.     int c = 0;
  41.     for(int i=0; i<n; ++i)
  42.         if(h[i].R < 10)
  43.             ++c;
  44.     cout << c << endl;
  45.  
  46. // masodik feladat
  47.     int cc = 0;
  48.     int temp[n];
  49.     for(int i=0; i<n; ++i)
  50.         if(h[i].R >= 10 && (h[i].Cs1 == 0 || h[i].Cs2 == 0))
  51.         {
  52.             temp[cc] = i+1;
  53.             ++cc;
  54.         }
  55.     cout << cc << " ";
  56.     for(int i=0; i<cc; ++i)
  57.         cout << temp[i] << " ";
  58.     cout << endl;
  59.  
  60.     return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment