Question
Directed Lab Work: write the program using c++ In this lab you will complete an application that uses the Abstract Data Type (ADT) stack The
Directed Lab Work: write the program using c++
In this lab you will complete an application that uses the Abstract Data Type (ADT) stack
The application you will complete implements a sorting a stack using another helper stack.
The stack should when sorted will have entries from the stack top to the stack bottom in ascending order (highest to lowest).
The stack sort in this lab is of O(n^2).
Read the
tutorial
File IO Read Correctly that is posted on Canvas.
The program should read in a file named stackLoader.txt that should have lines of space separated text integers, where each line of integers is to be loaded into a source stack.
See the recommended solution at the end of this document to learn how to read in a line of integers.
The program must:
Be modular and well structured
Have a function that reads a line of integers to be put into a stack and indicates when there is not any more data
Display the read in stack, using one function that displays the stack
A function that sorts the stack using only another helper stack and stack operations
Display the sorted stack, using one function that displays the stack
Loop around and repeat the processing
End the program when there is not any more data to be read in.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started