SHARE
TWEET

Untitled

a guest Oct 21st, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int liczba, i, j, a;
  8.     cout << "Ile liczb chcesz wpisac?" << endl;
  9.     cin >> liczba;
  10.  
  11.     int* tablica;
  12.     tablica = new int[liczba];
  13.     int* ranking_tablica;
  14.     ranking_tablica = new int[liczba];
  15.     for (i = 0; i < liczba; i++)
  16.     {
  17.         cin >> tablica[i];
  18.     }
  19.     for (i = 0; i < liczba;i++)
  20.     {
  21.         if(tablica[i]!=tablica[i-1])
  22.         cout << tablica[i] << endl;
  23.     }
  24.  
  25.     cout << "**********RANKING**********" << endl;
  26.  
  27.     for (a = 0; a < liczba; a++)
  28.     {
  29.         ranking_tablica[a] = 1;
  30.     }
  31.     for (i = 0; i < liczba; i++)
  32.     {
  33.         for (j = 0; j < liczba; j++)
  34.         {
  35.             if (i != j)
  36.             {
  37.                 if (tablica[i] < tablica[0 + j])
  38.                 {
  39.                     ranking_tablica[i]++;
  40.                 }
  41.             }
  42.         }
  43.        
  44.     }
  45.     for (i = 0; i < liczba; i++)
  46.     {
  47.         cout << tablica[i] << " jest na " << ranking_tablica[i] << " miejscu" << endl;
  48.     }
  49.  
  50.  
  51.     delete [] tablica;
  52.     delete [] ranking_tablica;
  53.     return 0;
  54. }
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
 
Top