First, please modify the data of CirQueue from fixed-size array to dynamic array. The
data size can be specified in the constructor, and the default size is 5. Then use a single
CirQueue to implement a stack named QStack. Notice that the speed of pop() of
QStack must be constant, O(1). QStack also has a public member function, out(), to
display the all data items.
Input / Output
Any combination of push() and pop() to operate an object of QStack.
Requirements
1. DO NOT use any standard library except std::cin and std::cout.
2. QStack only has one member data, an object of CirQueue.
3. Only few local variables (no more than five) can be used in each function. DO NOT declare any
global variable, static variable, fixed-size array and dynamic array.
4. The time consumption of pop() of QStack must be a constant time.
how write this
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.
We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.