avukas

Untitled

Apr 25th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <list>
  3.  
  4. using namespace std;
  5. template<typename Nekitip>
  6. void sortiraj(list<Nekitip> &lista){
  7. for(auto it(lista.begin()); it!=lista.end(); it++)
  8. for(auto it2(it); it2!=lista.end(); it2++)
  9. if(*it2<*it)
  10. swap(*it2,*it);
  11.  
  12. }
  13.  
  14. int main()
  15. {
  16. list<int>lista{1,3,4,6,7,8};
  17.  
  18. sortiraj(lista);
  19.  
  20. for (int x : lista) cout << x << " ";
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment