Guest User

Untitled

a guest
Aug 8th, 2012
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. Remove element from a list in C
  2. Account AccountList::remove(int i){
  3. if(i>=0 && i<size()) {
  4. for (int n = i; n < size(); n++) {
  5. if(i+1!=size()) {
  6. aList[n]=aList[n+1];
  7. }
  8. }
  9. sz--;
  10. return aList[i];
  11. } else {
  12. return Account();
  13. }
  14. }
  15.  
  16. Account AccountList::remove(int i)
  17. {
  18. if(i>=0 && i<size())
  19. {
  20. Account a = aList[i]
  21. for (int n = i; n < size() - 1; n++)
  22. {
  23. if(i+1!=size())
  24. {
  25. aList[n]=aList[n+1];
  26. }
  27. }
  28. sz--;
  29. return a;
  30. } else
  31. {
  32. return Account();
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment