Advertisement
Semior001

sort3

Nov 23rd, 2016
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. void sort(){
  2. int temp;
  3. bool sorted = false;
  4. while(!sorted){
  5. for(int i = 0; i < n-1; i++){
  6. if(sum[i] > sum[i+1]){
  7. sorted = false;
  8. temp = sum[i];
  9. sum[i] = sum[i+1];
  10. sum[i+1] = temp;
  11. }
  12. }
  13. sorted = true;
  14. }
  15. }
  16.  
  17. void reverse(){
  18. int temp;
  19. bool sorted = false;
  20. while(!sorted){
  21. for(int i = 0; i < n-1; i++){
  22. if(proz[i] < proz[i+1]){
  23. sorted = false;
  24. temp = proz[i];
  25. proz[i] = proz[i+1];
  26. proz[i+1] = temp;
  27. }
  28. }
  29. sorted = true;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement