-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstack.h
More file actions
executable file
·35 lines (30 loc) · 1.02 KB
/
stack.h
File metadata and controls
executable file
·35 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// stack.h
// Project 4 Spring 14
//
// Created by Ibrahima Niang on 5/7/14.
// Copyright (c) 2014 Ibrahima Niang. All rights reserved.
//
#ifndef Project_4_Spring_14_stack_h
#define Project_4_Spring_14_stack_h
#include <iostream>
#include <sstream>
using namespace std;
template<class xtype>
class stack
{
private:
int length; // hold the length of the stack
int max; // maximum elements in the stack
xtype *info; // will hold the elements of the stack
public:
stack(int); // constructor intialize the stack to the maximum of elements
~stack(); // destructor to destroy the stack
bool isFull(); // return true if the stack is full otherwise return false
bool isEmpty(); // return true if the stack is empty otherwise return false
void pop(); // delete the top element from the stack
void push(xtype); // add a new element to the stack
void print(); // print the stack, need for debug
xtype top(); // return the top elements of the stack
};
#endif