Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include "MailBox.h"
  2. #include <iostream>
  3. #include <String>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. MailBox::MailBox()
  9. {
  10. }
  11.  
  12.  
  13. MailBox::~MailBox()
  14. {
  15. }
  16.  
  17. void MailBox::addMail(Mail x) {
  18. numMail++;
  19. list.Push(x);
  20. }
  21.  
  22. Mail MailBox::getMail(int index) {
  23. Stack<Mail> buffer;
  24. Mail buff;
  25. for (int i = 0; i < index - 1; i++) {
  26. buffer.Push(list.Top());
  27. buffer.Pop();
  28. }
  29. buff = list.Top();
  30.  
  31. for (int i = 0; i < index - 1; i++) {
  32. list.Push(buffer.Top());
  33. buffer.Pop();
  34. }
  35.  
  36. return buff;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement