Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. /* Obliczanie */
  9. int n = 8;
  10. double T[n] = {5,7,8,9,8,9,1,6};
  11. int w;
  12. for(int x = 0 ; x < n-1 ; x++){
  13. w = x;
  14. for(int i = x+1 ; i < n ; i++)
  15. {
  16. if(T[i] < T[w])
  17. {
  18. w = i;
  19. }
  20. }
  21. swap(T[w] , T[x]);
  22. }
  23.  
  24. /*Wyprowadzenie */
  25. for(int j = 0; j < 8 ; j++){
  26. cout << T[j] << ", ";
  27. }
  28.  
  29.  
  30.  
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement