Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. void sort_movies(Movie V[], int n) {
  2. Movie swap;
  3. for (int i = 0; i < n; i++)
  4. {
  5. for (int j = 0; j < n; j++)
  6. {
  7. if (larger_than(V[i], V[j]))
  8. {
  9. swap = V[j];
  10. V[j] = V[i];
  11. V[i] = swap;
  12. }
  13. }
  14. }
  15. }
  16.  
  17. bool larger_than(const Movie& m1, const Movie& m2) {
  18.  
  19. int compare = 0;
  20. compare = m1.name.compare(m2.name);
  21. if (compare < 0)
  22. {
  23. return true;
  24. }
  25. else
  26. {
  27. return false;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement