Guest User

Untitled

a guest
Apr 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int size=10;
  5. int pole[size]={5,8,7,6,3,2,1,4,9,0};
  6.  
  7. void bsort(int *arr,int n)
  8. {
  9. for(int i=1;i<=n;i++)
  10. {
  11. for(int j=0;j<n-i;j++)
  12. {
  13. if(arr[j]>arr[j+1])
  14. {
  15. int pom=arr[j];
  16. arr[j]=arr[j+1];
  17. arr[j+1]=pom;
  18. }
  19. }
  20. }
  21.  
  22. }
  23.  
  24. int main()
  25. {
  26. cout << "Neserazene pole:" <<endl;
  27. for(int i=0;i<size;i++) cout<<pole[i]<<" ";
  28. cout << endl << "Serazene pole:" <<endl;
  29. bsort(pole,size);
  30. for(int i=0;i<size;i++) cout<<pole[i]<<" ";
  31.  
  32. cout<<endl<<endl;
  33. system("PAUSE");
  34. }
Add Comment
Please, Sign In to add comment