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 STACK_ADT
#define STACK_ADT
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 processNumbers(string, Stack &);
void printStack(Stack &);
int main()
{
printInfo();
cout "Enter input file name: " endl;
string filename;
getline(cin, filename); // assume valid
// declare stack here
// call processNumbers()
// call printStack()
return 0;
}
/*
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
Solve: header file #ifndef STACK _ ADT #define

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!