SHARE
TWEET

Untitled

a guest Nov 9th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4. struct concurs
  5. {
  6.     char nume[25], prenume[25];
  7.     char Sex;
  8.     int V, punctaj;
  9.  
  10. } C[1001];
  11. int main()
  12. {
  13.     int n, i, j;
  14.     cin >> n;
  15.     cin.get();
  16.     for(i = 1; i <= n; ++i)
  17.     {
  18.         cin >> C[i].nume >> C[i].prenume >> C[i].Sex >> C[i].V >> C[i].punctaj;
  19.         cin.get();
  20.     }
  21.  
  22.     for(i = 1; i < n; ++i)
  23.         for(j = i + 1; j <= n; ++j)
  24.             if(C[i].Sex == 'M' && C[j].Sex == 'M' && C[i].V >= 16 && C[i].V <= 20 && C[j].V >= 16 && C[j].V <= 20)
  25.                 if(C[i].punctaj < C[j].punctaj)
  26.                 {
  27.                     concurs aux;
  28.                     aux = C[i];
  29.                     C[i] = C[j];
  30.                     C[j] = aux;
  31.                 }
  32.  
  33.     for(i = 1; i <= n; ++i)
  34.         cout << C[i].nume << ' ' << C[i].prenume << ' ' << C[i].Sex << ' ' << C[i].V << ' ' << C[i].punctaj << '\n';
  35.     return 0;
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top