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