SHARE
TWEET

Untitled

a guest Oct 21st, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int zmierz(int arr[], int rozmiar, int numer);
  5. int main()
  6. {
  7.     int liczby[] = { 1,5,2,8,1,10,55,64 };
  8.     for (int i = 0; i < sizeof(liczby) / sizeof(liczby[0]); i++)
  9.     {
  10.         cout << liczby[i] << " jest na pozycji:" << zmierz(liczby, sizeof(liczby) / sizeof(liczby[0]), i) << endl;
  11.     }
  12.     return 0;
  13. }
  14. int zmierz(int arr[], int rozmiar, int numer)
  15. {
  16.     int position = 0;
  17.         for (int i = 0; i < rozmiar; i++)
  18.         {
  19.             if (arr[i] > arr[numer])
  20.                 position++;
  21.         }
  22.     return position+1;
  23. }
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