This repository was archived by the owner on Jan 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.h
More file actions
111 lines (97 loc) · 6.87 KB
/
Copy pathstack.h
File metadata and controls
111 lines (97 loc) · 6.87 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*----------------------------------------------------------------------------+
| Author: Jerome Richards |
| |
| Assignment: Project 6 |
| File: stack.h |
| |
| Instructor: Dr. Roger deBry |
| Class: CNS-1350 Section X01 |
| |
| Date Written: February 5, 2005 |
| |
| Description: CStack handle class definition |
+----------------------------------------------------------------------------*/
#ifndef stackH
#define stackH
using namespace std;
class CStackrep;
class CStack
{
private:
CStackrep* itsImpl;
public:
/*----------------------------------------------------------------------------+
| Purpose: Initialize the CStack class object |
| |
| Parameters: initSize is an integer specifying the inital size for the |
| stack |
| |
| Returns: nothing |
| |
| Pre-conditions: initSize >= 5 |
| |
| Post-conditions: none |
+----------------------------------------------------------------------------*/
CStack( int initSize = 5 );
/*----------------------------------------------------------------------------+
| Purpose: Release any dynamically allocated memory |
| |
| Parameters: none |
| Returns: nothing |
| |
| Pre-conditions: none |
| Post-conditions: none |
+----------------------------------------------------------------------------*/
~CStack();
/*----------------------------------------------------------------------------+
| Purpose: Place the value on the top of the stack |
| |
| Parameters: theData an integer to be stored on the stack |
| Returns: nothing |
| |
| Pre-conditions: none |
| Post-conditions: none |
+----------------------------------------------------------------------------*/
void push( int theData );
/*----------------------------------------------------------------------------+
| Purpose: Remove the top value from the stack |
| |
| Parameters: none |
| Returns: nothing |
| |
| Pre-conditions: none |
| Post-conditions: none |
+----------------------------------------------------------------------------*/
void pop();
/*----------------------------------------------------------------------------+
| Purpose: Return the top value on the stack |
| |
| Parameters: none |
| Returns: an integer |
| |
| Pre-conditions: none |
| Post-conditions: none |
+----------------------------------------------------------------------------*/
int top();
/*----------------------------------------------------------------------------+
| Purpose: Return the size of the stack |
| |
| Parameters: none |
| Returns: an integer |
| |
| Pre-conditions: none |
| Post-conditions: none |
+----------------------------------------------------------------------------*/
int stackSize();
/*----------------------------------------------------------------------------+
| Purpose: Return the amount of free space on the stack |
| |
| Parameters: none |
| Returns: an integer |
| |
| Pre-conditions: none |
| Post-conditions: none |
+----------------------------------------------------------------------------*/
int freeSpace();
};
#endif