Question: C++ Stacks Your solution doesn't have to be completely correct. Try to complete as much code as possible, don't offer any psuedocode. Thanks. 1. Introduction

C++ Stacks

Your solution doesn't have to be completely correct. Try to complete as much code as possible, don't offer any psuedocode. Thanks.

C++ Stacks Your solution doesn't have to be completely correct. Try to

complete as much code as possible, don't offer any psuedocode. Thanks. 1.

Introduction My friend SSS is the owner of a bookstore. She buys

and sells books. After buying she can store books either in the

shelf maintaining the queue, or piling books one upon one using the

stack. But the problem is, during selling the book, she needs to

1. Introduction My friend SSS is the owner of a bookstore. She buys and sells books. After buying she can store books either in the shelf maintaining the queue, or piling books one upon one using the stack. But the problem is, during selling the book, she needs to move books from the top of the stack, or from the front of the queue to get the specific book. Find out the cost, number of moves, that she needs for the stack, d for the queue to get the specific book. Note: It is required to implement the Stack and Queue by yourself. See the Implementation section to be clear how to implement it. 2. Input and Output The input and output file is a regular text file, where each line is terminated with a In' character Input file format: Each line is a combination of a command and a book name. Command and book name is separated by a single space. The command can be only either "buy" or "sale" If there is an empty line, you should ignore it. Output file format: Your program will generate output only for "sale" command For a successful sale command, the output will be like, Book_name finding cost at stack: value, at queue:value For an unsuccessful sale command, the output will be like, Book name not found You know, Stack follows LIFO, last in first out, order, and Queue follows FIFO, first in first out, order. You will add book into both stack and queue after buying. To 1. Introduction My friend SSS is the owner of a bookstore. She buys and sells books. After buying she can store books either in the shelf maintaining the queue, or piling books one upon one using the stack. But the problem is, during selling the book, she needs to move books from the top of the stack, or from the front of the queue to get the specific book. Find out the cost, number of moves, that she needs for the stack, d for the queue to get the specific book. Note: It is required to implement the Stack and Queue by yourself. See the Implementation section to be clear how to implement it. 2. Input and Output The input and output file is a regular text file, where each line is terminated with a In' character Input file format: Each line is a combination of a command and a book name. Command and book name is separated by a single space. The command can be only either "buy" or "sale" If there is an empty line, you should ignore it. Output file format: Your program will generate output only for "sale" command For a successful sale command, the output will be like, Book_name finding cost at stack: value, at queue:value For an unsuccessful sale command, the output will be like, Book name not found You know, Stack follows LIFO, last in first out, order, and Queue follows FIFO, first in first out, order. You will add book into both stack and queue after buying. To

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!