Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. void utworz(int *a)
  4. {
  5. //a[7]={5,4,8,3,2,9,1};
  6. a[0]=5;
  7. a[1]=4;
  8. a[2]=8;
  9. a[3]=3;
  10. a[4]=2;
  11. a[5]=9;
  12. a[6]=1;
  13. }
  14. void pokaz(int *a)
  15. {
  16. cout<<"ciag : "<<endl;
  17. for(int i=0 ; i<7 ; i++)
  18. {
  19. cout<<a[i]<<" ";
  20. }
  21.  
  22. }
  23. void sort(int *a)
  24. {
  25. for (int i=1; i<7 ; i++)
  26.  
  27. for (int j=1 ; j<7 ; i++)
  28.  
  29. if(a[j-1]>a[j])
  30. {
  31. int pom=a[j];
  32. a[j]=a[j-1];
  33. a[j-1]=pom;
  34. }
  35.  
  36.  
  37. }
  38.  
  39.  
  40.  
  41. int main()
  42. {
  43. int tab[7];
  44. utworz(tab);
  45. pokaz(tab);
  46. sort(tab);
  47. pokaz(tab);
  48.  
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement