Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. void zam(int *a, int *b){
  2. int zacas;
  3. zacas=*a;
  4. *a=*b;
  5. *b=zacas;
  6.  
  7. }
  8.  
  9.  
  10. int main() {
  11. int polje[20] = {20, 9 ,1, 30, 14, 3, 5, 8, 22, 16, 69, 100, 45, 32, 11, 4, 7, 4, 19, 25};
  12. //BubbleSort(&polje);
  13.  
  14. /* for(int i=0;i<20);i++){
  15. if(polje[i]>polje[i+1]){
  16.  
  17. }
  18. }
  19. */
  20.  
  21. int arr[5] = {2,4,3,5,1};
  22. //for(int i=1;i<5;i++){
  23. for(int j=0;j<5;j++){
  24. if(arr[j]>arr[j+1]){
  25. zam(&arr[j],&arr[j+1]);
  26. cout << arr[j] << " " << arr[j+1] << " ";
  27. }
  28. //}
  29.  
  30. }
  31.  
  32.  
  33.  
  34. //int velikost_polja = sizeof(polje)/sizeof(polje[0]);
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement