fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int N=5;
  5. int tab[N]={6,3,5,9,2};
  6.  
  7. void wypisz()
  8. {
  9. for(int i=0;i<N;i++)
  10. cout << tab[i] << " ";
  11. cout << endl;
  12. }
  13.  
  14. void sort_b()
  15. {
  16. for (int i=0;i<N-1;i++)
  17. for(int j=0; j<N-1;j++)
  18. if (tab[j]>tab[j+1])
  19. swap(tab[j], tab[j+1]);
  20. }
  21.  
  22.  
  23. int main() {
  24.  
  25. wypisz();
  26. sort_b();
  27. wypisz();
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
6 3 5 9 2 
2 3 5 6 9