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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, rd1369
Some of your friends have gotten into the burgeoning field of time-series data mining, in which one looks for patterns in sequences of events that occur over time. purchases at stock exchanges"what's being bought" are one source of data with a natural ordering in time. given a long sequence s of such events, your friends want an efficient way to detect certain "patterns" in them"for example, they may want to know if the four events buy yahoo, buy ebay, buy yahoo, buy oracle occur in this sequence s, in order but not necessarily consecutively. they begin with a collection of possible events (e. g., the possible transactions) and a sequence s of n of these events. a given event may occur multiple times in s (e. g., yahoo stock may be bought many times in a single sequence s). we will say that a sequence s is a subsequence of s if there is a way to delete certain of the events from s so that the remaining events, in order, are equal to the sequence s . so, for example, the sequence of four events above is a subsequence of the sequence buy amazon, buy yahoo, buy ebay, buy yahoo, buy yahoo, buy oracle their goal is to be able to dream up short sequences and quickly detect whether they are subsequences of s. so this is the problem they pose to you: give an algorithm that takes two sequences of events"s of length m and s of length n, each possibly containing an event more than once"and decides in time o(m + n) whether s is a subsequence of s.
Answers: 3
image
Computers and Technology, 23.06.2019 11:00, danielcano12281621
Sports and entertainment class, your goal is to increase attendance and make a profit for a game by getting your team on a winning track with total salaries less than $3,000,000
Answers: 3
image
Computers and Technology, 24.06.2019 21:40, imamador6396
Which of these is not a type of socket? aga (alternating grid array) pga (pin grid array) spga (staggered pin grid array) lga (land grid array)
Answers: 1
image
Computers and Technology, 24.06.2019 23:00, Kaziyah461
People should never use telepresence when virtually meeting with a group of co-workers. true false
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 in other subjects:

Konu
Chemistry, 23.01.2021 08:10
Konu
Mathematics, 23.01.2021 08:10
Konu
Mathematics, 23.01.2021 08:10