Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include "simpio.h"
  3. #include "console.h"
  4. #include "MyQueue.h"
  5.  
  6. using namespace std;
  7.  
  8. int main(){
  9. MyQueue queue;
  10.  
  11. for(int i = 1; i < 12; i++){
  12. queue.enque(i);
  13. }
  14.  
  15. cout << "size = " << queue.size() << " must be 11" << endl;
  16.  
  17. cout << "testing peek(), must return 1 -> " << queue.peek() << endl;
  18.  
  19. cout << "begining deque, from 1 to 11" << endl;
  20.  
  21. for(int i = 0; i < 11; i++){
  22. cout << queue.deque() << endl;
  23. }
  24.  
  25. cout << "end of deque" << endl;
  26.  
  27. cout << "size = " << queue.size() << " must be 0" << endl;
  28.  
  29. cout << "testing isEmpty(). value should be 1 -> " << queue.isEmpty() << endl;
  30.  
  31.  
  32. for(int i = 0; i < 110; i++){
  33. queue.enque(i);
  34. }
  35.  
  36. for(ont i = 0; i< 110; i++){
  37. queue.deque();
  38. }
  39.  
  40.  
  41. cout << "now it should throw error" << endl;
  42.  
  43. cout << queue.deque();
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement