Guest User

Untitled

a guest
Oct 18th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. int main(){
  2. deque<Cars> card;
  3. deque<Cars> iterator::iter
  4. int count=0;
  5. Cars car(14,15);
  6. card.push_front(car);
  7. Cars car(12,45);
  8. card.push_front(car);
  9. Cars car(15,60);
  10. card.push_front(car);
  11. Cars car(20,45)
  12. card.push_front(car);
  13. for(iter=card.begin();iter!=card.end();iter++){
  14. if(iter->getnum2()==60){
  15. card.erase(card.begin()+count);
  16.  
  17. }
  18. count=count+1;
  19.  
  20. }
  21. return 0;
  22.  
  23. }
  24.  
  25. for ( iter = card.begin(); iter != card.end() ; )
  26. (iter->getnum2() == 60) ? iter = card.erase(iter) : ++iter;
Add Comment
Please, Sign In to add comment