| 92 | |
| 93 | |
| 94 | int main() { |
| 95 | |
| 96 | Queue<int> q; |
| 97 | |
| 98 | int choice; |
| 99 | cin >> choice; |
| 100 | int input; |
| 101 | |
| 102 | while (choice !=-1) { |
| 103 | if(choice == 1) { |
| 104 | cin >> input; |
| 105 | q.enqueue(input); |
| 106 | } |
| 107 | else if(choice == 2) { |
| 108 | int ans = q.dequeue(); |
| 109 | if(ans != 0) { |
| 110 | cout << ans << endl; |
| 111 | } |
| 112 | else { |
| 113 | cout << "-1" << endl; |
| 114 | } |
| 115 | } |
| 116 | else if(choice == 3) { |
| 117 | int ans = q.front(); |
| 118 | if(ans != 0) { |
| 119 | cout << ans << endl; |
| 120 | } |
| 121 | else { |
| 122 | cout << "-1" << endl; |
| 123 | } |
| 124 | } |
| 125 | else if(choice == 4) { |
| 126 | cout << q.getSize() << endl; |
| 127 | } |
| 128 | else if(choice == 5) { |
| 129 | if(q.isEmpty()) { |
| 130 | cout << "true" << endl; |
| 131 | } |
| 132 | else { |
| 133 | cout << "false" << endl; |
| 134 | } |
| 135 | } |
| 136 | cin >> choice; |
| 137 | } |
| 138 | |
| 139 | } |