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 21:00
Ulia is planning to attend the same private four-year college her parents attended. she wants to save at least $18,000 in four years to contribute to her college education. which monthly deposit amounts can julia use to achieve her goal? check all that apply.
Answers: 2
question
Computers and Technology, 23.06.2019 18:20
What is wi-fi infrastructure? a metropolitan area network that uses radio signals to transmit and receive data a communications technology aimed at providing high-speed wireless data over metropolitan area networks a means by which portable devices can connect wirelessly to a local area network, using access points that send and receive data via radio waves includes the inner workings of a wi-fi service or utility, including the signal transmitters, towers, or poles and additional equipment required to send out a wi-fi signal
Answers: 2
question
Computers and Technology, 24.06.2019 13:20
3. ranga ramasesh is the operations manager for a firm that is trying to decide which one of four countries it should research for possible outsourcing providers. the first step is to select a country based on cultural risk factors, which are critical to eventual business success with the provider. ranga has reviewed outsourcing provider directories and found that the four countries in the table that follows have an ample number of providers from which they can choose. to aid in the country selection step, he has enlisted the aid of a cultural expert, john wang, who has provided ratings of the various criteria in the table. the resulting ratings are on a 1 to 10 scale, where 1 is a low risk and 10 is a high risk. john has also determined six criteria weightins: trust, with a weight of 0.3; quality, with 0.2; religious, with 0.1; individualism, with 0.2; time, with 0.1; and uncertainity, with 0.1. using the factor-rating method, which country should ranga select? why? (2 points)
Answers: 3
question
Computers and Technology, 24.06.2019 17:40
Which of the following processes applications across multiple computing devices? a. functional application b. distributed system c. workgroup information silo d. information silo
Answers: 3
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, 21.10.2020 22:01
question
Mathematics, 21.10.2020 22:01
question
Mathematics, 21.10.2020 22:01
question
Chemistry, 21.10.2020 22:01
Questions on the website: 13722360