
I can not use any of the stack libraries, i have to create the operators using arrays.
The code must be written using c++
Write a program that will sort a set of numbers. The program will use two array-based stacks. The stack that is being used at a given instant is called the working stack. When a new number is read, the non-working stack will be empty. One of the stacks will be arranged with the smallest element of the stack on the bottom, the other with the smallest element at the top. To process a number, test it against the top element of the "current" working stack. If it fits there, push it. If it does not fit, pop the top element of the working stack, push it on to the other stack, and continue testing. When the number "fits", push it on the other stack and empty the working stack onto the other stack. When the working stack is empty, the other stack becomes the new working stack. Use the stack definitions and functions discussed in class. Do not manipulate the stacks except by calling the stack functions. Your main function should contain mostly function calls. Do not duplicate logic. Follow all good programming techniques. INPUT: 1. Assume that each stack holds at most 40 values. 2. Fill in your own data file containing at least 30 non-sorted integers. 3. Your program should be able to handle any data file of integers. OUTPUT: 1. Print the contents of the working stack after each number is added. 2. Print the sorted values in ascending and descending order. NOTE: All output should have appropriate headers and be completely formatted.

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

- C PROGRAMMING Must be written in Carrow_forwardHow difficult is it to duplicate a collection of shared pointers into another array while using the C++ programming language? Create a list of the several approaches you may use to tackle the issue that has been presented to you. Is it the case that copying a shared pointer also copies the objects that it controls? Explainarrow_forwardThis is warning you, don't use any AI platform to generate answer.arrow_forward
- In C++ please and thank you!arrow_forwardIdentify the difference between STACK and ARRAY.arrow_forwardC++ In this lab, you're going to be working with partially filled arrays that are parallel with each other. That means that the row index in multiple arrays identifies different pieces of data for the same person. This is a simple payroll system that just calculates gross pay given a set of employees, hours worked for the week and hourly rate. Parallel Arrays First, you have to define several arrays in your main program: employee names for each employee hourly pay rate for each employee total hours worked for each employee gross pay for each employee You can use a global SIZE of 50 to initialize these arrays. Second, you will need a two dimension (2-D) array to record the hours worked each day for an employee. The number of rows for the 2-D array should be the same as the arrays above since each row corresponds to an employee. The number of columns represents days of the week (7 last I looked). Functions Needed In this lab, you must read in the employee names first because this…arrow_forward
- help with c++...paste indented code plzz Q3: Ask user enter size of array N, then ask user enter maximum number of array element X, then create an array size N, and assign each element of array to random number between 1~X. Print the array, and also find which element appeared most in the array, print all if there are multiple elements which are most at the same time. Sample input: Enter N: 20 Enter X: 10 Sample output: 8 7 10 8 1 7 4 3 4 7 5 6 4 3 1 10 1 9 9 10 1 4 7 appear mostarrow_forwardThe destination of a function's return value may be represented as a sequence of instructions. When making modifications to the stack, keep in mind that they must not prevent the method from returning to its caller.arrow_forwardP1: this is data structure of algorithms subject and topic is all about Stack Applicationsarrow_forward
- A series of commands can be used to display a function's return address. Remember that any changes you make to the stack cannot prevent the procedure from returning to its caller.arrow_forwardIt is possible to see the function's return address by issuing a set of instructions. It's important to remember that modifying the stack shouldn't prevent the process from returning to its caller.arrow_forwardIn C++, the first element of the array is referenced as array[0]. Explore the web and find the history of this choice. Some languages and packages like MATLAB start the indices from 1. That is, the first element of the array is referred to as array[1] not array[0]. If you were the creators of C++, which of the conventions for the array indices would you chose? Starting from 0 or 1.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





