subject

I need help with this assignment. Please, someone, help me to fill these codes. I really do not know what I need to do. This is C++ (Data abstraction). I have to submit this assignment today. Please I'm really stressed out how to solve this problem. Thank you for understanding.
This is the assignment:

Project: One of the stack applications is to backtrack. As an example take a list of numbers. Negative numbers, 0, and 1 represent “commends”, the rest of the integers represent “data”. You may assume the input files contain valid data.
o Each time we read 0, display the number of elements in the stack. o Each time we read 1, display the element at the top of the stack. o Each time we read a positive number we push it onto the stack, and o Each time we read a negative number, we pop and print as many values from the stack as the absolute value of the negative number. If there are fewer numbers in the stack, print a message and nothing else. o When the end of the file is detected, print a message and the items left in the stack, if any.

See two examples on the next page and more details/requirements on the last page.

Input: Create the three input files using the following data or use the given files. numbers1.txt 10 20 30 1 40 0 50 -2 15 25 -3 60 70
numbers2.txt 1 0 20 30 40 -9 1 0 10 40 90 50 -6
numbers3.txt 15 25 35 45 0 1 0 55 65 1 75 0 1 0 -50 0 1 0 -5 10 40 50 60 70 80 90 0 1 0 -3 13 23 33 43 54 -5 0 1 0 17 27 7 47 57 67 77 87 97 19 29 39 49 59 69 79 89 99 0 1 -6 0 1 14 24 34 44 0 -150 54 64 0
Run the program once and save the output at the end of the source file as a comment. Compress the source and header files, input and output files (if any), and upload the compressed file: 22C_LastName_FirstName_H1.zip
Example 1: If the input file contains the following numbers: 10 20 30 1 40 0 50 -2 15 25 -3 60 70 Process input using a stack: Read 10, Push 10 Read 20, Push 20 Read 30, Push 30 Read 1, Display the element at the top of the stack: 30 Read 40, Push 40 Read 0, Display the number of elements in the stack: 4 Read 50, Push 50 Read -2, Pop and print 2 numbers: 50 and 40 Read 15, Push 15 Read 25, Push 25 Read -3, Pop and print 3 numbers: 25, 15 and 30 Read 60, Push 60 Read 70, Push 70 END OF FILE Display the stack from top to bottom: 70, 60, 20 and 10 Format output as shown below (do not show the processing details) Input File: numbers1.txt Top: 30 Count: 4 Top 2: 50 40 Top 3: 25 15 30 Stack: 70 60 20 10
Example 2: If the input file contains the following numbers: 0 1 10 20 30 -6 40 50 -5 Process input using a stack: Read 0, Display the number of elements in the stack: 0 Read 1, Display the element at the top of the stack: Empty Read 10, Push 10 Read 20, Push 20 Read 30, Push 30 Read -6, Display “Error” message since there are less than 6 items in the stack and do not change the stack. Read 40, Push 40 Read 50, Push 50 Read -5: Pop and print 5 numbers 50, 40, 30, 20 and 10 END OF FILE Display “Empty” Format output as shown below (do not show the processing details) Input File: myFile. txt Count: 0 Top: Empty Error Stack: 50 40 30 20 10 Stack: Empty

This is the first code:

#include
#include
#include
#include
#include

using namespace std;

#include "StackADT. h"

void printInfo();
void showTimeStamp();

int main()
{
string filenames[] = { "numbers1.txt", "numbers2.txt", "numbers3.txt", "" };

printInfo();
for (int i = 0; filenames[i] != ""; i++)
{
// call a function to process the input file using a stack
}

showTimeStamp();
return 0;
}

/*~*~*~*~*~*~
This function displays the project's title
*~*/
void printInfo()
{
cout << "Project: Stack ADT" << endl;
}

/*~*~*~*~*~*~
This function displays the current date and time
*~*/
void showTimeStamp()
{
time_t timeval = time(0);
char* chtime = ctime(&timeval);
cout << "\n" << chtime << endl;
}

/*~*~*~*~*~*~ Save the output below

*~*/

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:50
Which are steps taken to diagnose a computer problem? a) reproducing the problem and using error codes b) reproducing the problem and troubleshooting c) using error codes and troubleshooting d) using error codes and stepping functions
Answers: 1
question
Computers and Technology, 22.06.2019 22:40
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
What are ways to switch windows in excel? check all that apply. on the status bar, click the windows button, and then click the file name. on the task bar, click to display the excel jump list, and then click the file name. on the view tab, in the window group, click switch windows, and then click the file name. on the review tab, in the viewing group, click files, and then click the file name.
Answers: 1
question
Computers and Technology, 23.06.2019 10:50
The volume v and paper surface area a of a conical paper cup are given by where r is the radius of the base of the cone and h is the height of the cone. a. by eliminating h, obtain the expression for a as a function of r and v. b. create a user-de ned function that accepts r as the only argument and computes a for a given value of v. declare v to be global within the function. c. for v ! 10 in.3 , use the function with the fminbnd function to compute the value of r that minimizes the area a. what is the corresponding value of the height h? investigate the sensitivity of the solution by plotting v versus r. how much can r vary about its optimal value before the area increases 10 percent above its minimum value?
Answers: 1
You know the right answer?
I need help with this assignment. Please, someone, help me to fill these codes. I really do not know...
Questions
question
Mathematics, 27.02.2021 21:50
question
Mathematics, 27.02.2021 21:50
question
Mathematics, 27.02.2021 21:50
question
Mathematics, 27.02.2021 21:50
Questions on the website: 13722360