-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
45 lines (34 loc) · 872 Bytes
/
main.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
#include <iostream>
#include "assert.h"
#include "MyStack.h"
#include "stdlib.h"
int main()
{
Stlib::Stack st1;
Stlib::Stack st2(12);
for(int i=0;i<24;i++)
{
st1.push(i);
printf("size = %d, capacity = %d\n-------------------\n", (int)st1.size(), (int)st1.capacity());
}
st1.dump();
printf("pop pop pop\n");
for(int i=0;i<24;i++)
{
st1.pop();
printf("size = %d, capacity = %d, hsum = %d"
"\n--------------------\n", (int)st1.size(), (int)st1.capacity(), st1.hsum());
}
// for(int i=0;i<21;i++)
// {
// st2.push(i);
// printf("[%d] = %d\n", i, st2.data_[i]);
// }
//
// while(!st2.isempty()){
// printf(" %f,", st2.pop());
// //printf("capdown = %d\n",st2.capa());
// }
//std::cout<<st2.pop(); //stack underflow
return 0;
}