daily pastebin goal
0%
SHARE
TWEET

Untitled

a guest Jan 16th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. void sortuj(vector<int> &tablica,int n){
  6. for(int i=1; i<n; i++){
  7.     for(int j=n-1; j>=1; j--){
  8.         if(tablica[j]>tablica[j-1]){
  9.             int bufor; bufor=tablica[j-1];
  10.             tablica[j-1]=tablica[j];
  11.             tablica[j]=bufor;
  12.  
  13.         }
  14.     }
  15. }
  16. }
  17.  
  18.  
  19. void wyswietl(vector<int> &tablica, int n){
  20. for(int i=0; i<n; i++){
  21.     cout << tablica[i] << "\n";
  22. }
  23. }
  24.  
  25.  
  26. int main()
  27. {
  28. int N;
  29. cin >> N;
  30. vector<int> tablica(N);
  31.  
  32.  
  33.     for(int i=0; i<tablica.size(); i++){
  34.         cin >> tablica[i];
  35.     }
  36.  
  37. sortuj(tablica,N);
  38. wyswietl(tablica,N);
  39. }
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