-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemplates.cpp
47 lines (41 loc) · 842 Bytes
/
Templates.cpp
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
#include <iostream>
#include "Templates.h"
using namespace std;
int main(int argc, char **argv)
{
Stack<int> stack;
int i=0;
int out_item=0;
bool ret_val=false;
for (i=0; i<13; i++)
{
ret_val = stack.push(i);
if (!ret_val)
{
cout<<"The stack is full!"<<"\n";
ret_val = stack.empty();
if (ret_val)
{
cout<<"stack cleared!"<<"\n";
}
}
else
{
cout<<"pushed to stack: "<<i<<"\n";
}
}
for (i=0; i<13; i++)
{
ret_val = stack.pop(out_item);
if (ret_val)
{
cout<<"Popped from stack: "<<out_item<<"\n";
}
else
{
cout<<"stack is empty"<<"\n";
break;
}
}
return 1;
}