Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main()
- {
- queueType<int> q1;
- q1.addQueue(1);
- q1.addQueue(2);
- q1.addQueue(3);
- q1.addQueue(4);
- q1.addQueue(5);
- q1.addQueue(6);
- q1.addQueue(7);
- q1.addQueue(8);
- q1.addQueue(9);
- queueType<int>q2;
- queueType<int>q3;
- stackType<int> s1;
- int len=0;
- while(!q1.isEmptyQueue())
- {
- len++;
- q2.addQueue(q1.front());
- q1.deleteQueue();
- }
- cout << len;
- len/=2;
- cout << endl;
- for(int i =0; i <= len; i++)
- {
- q1.addQueue(q2.front());
- cout << q2.front() << " ";
- q2.deleteQueue();
- }
- while(!q2.isEmptyQueue())
- {
- s1.push(q2.front());
- q2.deleteQueue();
- }
- cout << endl;
- while(!s1.isEmptyStack())
- {
- q3.addQueue(s1.top());
- cout << s1.top() << " ";
- s1.pop();
- }
- }
Add Comment
Please, Sign In to add comment