Advertisement
erick016

helloClient.C

Oct 10th, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. #include "hello.h"
  2. #include<iostream>
  3.  
  4. using namespace std;
  5.  
  6. void caseOne()
  7. {
  8. hello l;
  9. int box;
  10. cout<<l.isEmpty()<<endl;
  11. l.displayAll();
  12. l.addRear(1);
  13. l.addRear(2);
  14. l.addRear(3);
  15. l.displayAll();
  16. l.deleteFront(box);
  17. l.deleteFront(box);
  18. l.displayAll();
  19. cout<<l.isEmpty()<<endl;
  20. l.deleteFront(box);
  21. cout<<l.isEmpty()<<endl;
  22.  
  23. }
  24.  
  25. void caseTwo()
  26. {
  27. hello l;
  28. int box;
  29. l.addFront(5);
  30. l.addFront(4);
  31. l.deleteFront(box);
  32. l.addRear(6);
  33. l.addRear(8);
  34. l.addRear(9);
  35. l.displayAll();
  36. l.addbeforeIth(1,4);
  37. l.addbeforeIth(4,7);
  38. l.addbeforeIth(7,10);
  39. {
  40. //l.addbeforeIth(9,12);
  41. }
  42. catch (hello::OutOfRange)
  43. {cerr << "Error has occurred: out of range"; }
  44. try
  45. {
  46. //l.addbeforeIth(0,0);
  47. }
  48. catch (hello::OutOfRange)
  49. {cerr << "Error has occurred: out of range"; }
  50.  
  51. l.displayAll();
  52. // l.deleteIth(1,box);
  53. // l.deleteIth(6,box);
  54. // l.deleteIth(3,box);
  55. try
  56. {
  57. //l.deleteIth(5,box);
  58. }
  59. catch (hello::OutOfRange)
  60. {cerr << "Error has occurred: out of range"; exit(1); }
  61. try
  62. {
  63. //l.deleteIth(0,box);
  64. }
  65. catch (hello::OutOfRange)
  66. {cerr << "Error has occurred: out of range"; exit(1); }
  67.  
  68. //l.displayAll();
  69. /* while(!l.isEmpty())
  70. l.deleteRear(box);*/
  71. // l.displayAll();
  72.  
  73. }
  74.  
  75. void caseThree()
  76. {
  77. }
  78.  
  79. int main()
  80. {
  81. int userCase;
  82. cout << "Which case would you like to run? 1-4." << endl;
  83. cin >> userCase;
  84.  
  85. switch(userCase)
  86. {
  87. case 1:
  88. caseOne();
  89. break;
  90.  
  91. case 2:
  92. caseTwo();
  93. break;
  94.  
  95. case 3:
  96. cout<<"to";
  97. break;
  98.  
  99. case 4:
  100. cout<<"eat";
  101. break;
  102.  
  103. default:
  104. break;
  105. }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement