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