Question: Solve: header file #ifndef STACK _ ADT #define STACK _ ADT template class Stack { private: / / Structure for the stack nodes struct StackNode
Solve:
header file
#ifndef STACKADT
#define STACKADT
template
class Stack
private:
Structure for the stack nodes
struct StackNode
T value; Value in the node
StackNode next; Pointer to next node
;
StackNode top; Pointer to the stack top
int length;
public:
Constructor
Destructor
Stack operations:
push
pop
peek
isEmpty
getLength
;
Member function push inserts the argument onto
the stack.
Member function pop deletes the value at the top
of the stack and returns it
Assume stack is not empty.
Destructor:
Traverses the list deleting each node without calling pop
#endif
Cpp file
#include
#include
#include
#include
#include "StackADT.h
using namespace std;
void printInfo;
void processNumbersstring Stack &;
void printStackStack &;
int main
printInfo;
cout "Enter input file name: endl;
string filename;
getlinecin filename; assume valid
declare stack here
call processNumbers
call printStack
return ;
This function displays the project's title
void printInfo
cout ~~ Project: Stack ADT ~~ endl;
define processNumbers a function to process the input file
define printStack a function to print the stack
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
