Advertisement
Guest User

Untitled

a guest
Jan 27th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <list>
  4. using namespace std;
  5. struct cijeli{
  6. int x;
  7. bool operator()(cijeli a, cijeli b)
  8. {
  9. return abs(a.x) < abs(b.x);
  10. }
  11. bool operator()(const cijeli &a)
  12. {
  13. return abs(a.x) > 10;
  14. }
  15. };
  16.  
  17. int main()
  18. {
  19. list<cijeli> niz(10);
  20. cijeli a;
  21. for(int i = 0; i<10; i++)
  22. {
  23.  
  24. cin >> a.x;
  25. niz.push_back(a);
  26. }
  27. niz.sort(cijeli());
  28. niz.remove_if(cijeli());
  29. for(list<cijeli>::reverse_iterator i = niz.rbegin(); i != niz.rend(); i++)
  30. cout << (*i).x << " ";
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement