Advertisement
Cinestra

Sort

Jan 7th, 2023
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. void sort(int array[], bool ascending)
  2. {
  3. int temp;
  4.  
  5. if (ascending)
  6. {
  7. for (int i = 2; i < array[1] + 2; i++)
  8. {
  9. for (int j = i + 1; j < array[1] + 2; j++)
  10. {
  11. if (array[j] < array[i])
  12. {
  13. temp = array[i];
  14. array[i] = array[j];
  15. array[j] = temp;
  16. }
  17. }
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement