
Code in C, Implement a C
Code a stack and queue test driver. A test driver is a program created to test functions that are
to be placed in a library. Its primary purpose is to completely test functions; therefore, it has no
application use. The functions to be tested are push stack, pop stack, enqueue, and dequeue.
You may include other stack and queue functions as required. All data should be integers. You
need two stacks and two queues in the program, as described below.
a. Input stack: used to store all user input
b. Input queue: used to store all user input
c. Output stack: used to store data deleted from input queue
d. Output queue: used to store data deleted from input stack
Use a menu-driven user interface that prompts the user to select either insert or delete. If an
insert is requested, the system should prompt the user for the integer to be inserted. The data
are then inserted into the input stack and input queue. If a delete is requested, the data are
deleted from both structures: the data popped from the input stack are enqueued in the output
queue, and the data dequeued from the input queue are pushed into the output stack.
Processing continues until the input structures are empty. At this point print the contents of the
output stack while deleting all of its data. Label this output "Output Stack", then print all of the
data in the output queue while deleting all of its data. Label this output "Output Queue."

Trending nowThis is a popular solution!
Step by stepSolved in 5 steps

- Please use C++ programming for the excerise below but come up with code for class linkedStackType instead of stackType Also, provide the code itself and a sample outputarrow_forwardWhat are the operations that can be performed on a stack?arrow_forwardWhat are the operations that can be performed on a stack?arrow_forward
- 1. A company wants to evaluate employee records in order to lay off some workers on the basis of service time (the most recently hired employees are laid off first). Only the employee ids are stored in stack. Write a program using stack and implement the following functions: Main program should ask the appropriate option from the user, until user selects an option for exiting the program. Enter_company (emp_id)- the accepted employee id(integer) is pushed into stack. Exit_company ()- The recently joined employee will be laid off from the company Show employee ()- display all the employees working in the company. count()- displays the number of employees working in the company. i) ii) iii) iv)arrow_forwardComplete the following ():a. A stack is used by the system when a function call is madeb. A stack can become full during program executionarrow_forwardWhat are the operations that can be performed on a stack?arrow_forward
- Assume class StackType has been defined to implement a stack data structure as discussed in your textbook (you may also use the stack data structure defined in the C++ STL). Write a function that takes a string parameter and determines whether the string contains balanced parentheses. That is, for each left parenthesis (if there is any) there is exactly one matching right parenthesis later in the string and every right parenthesis is preceded by exactly one matching left parenthesis earlier in the string. e.g. abc(c(x)d(e))jh is balanced whereas abc)cd(e)(jh is not. The function algorithm must use a stack data structure to determine whether the string parameter satisfies the condition described above. Edit Format Table 12pt v Paragraph v |BIU A v ev T? WP O words ....arrow_forwardEach function has local memory associated with it to hold incoming parameters, local variables, and (in some cases) temporary variables. This region of memory is called a stack frame. Question 7 options: True Falsearrow_forwardWhat are the two sorts of stack parameters that are often used?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





