-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
50 lines (45 loc) · 1.1 KB
/
Copy pathmain.cpp
File metadata and controls
50 lines (45 loc) · 1.1 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
#include "MutantStack.hpp"
#include <iostream>
int main()
{
{
MutantStack<int> mstack;
mstack.push(5);
mstack.push(17);
std::cout << mstack.top() << std::endl;
mstack.pop();
std::cout << mstack.size() << std::endl;
mstack.push(3);
mstack.push(5);
mstack.push(737);
//[...]
mstack.push(0);
MutantStack<int>::iterator it = mstack.begin();
MutantStack<int>::iterator ite = mstack.end();
++it;
--it;
while (it != ite)
{
std::cout << *it << std::endl;
++it;
}
std::stack<int> s(mstack);
}
MutantStack<std::string> stack;
stack.push ("Hello");
stack.push ("Sailor!");
stack.push ("There");
stack.push ("Are");
stack.push ("69,105");
stack.push ("Leaves");
stack.push ("In");
stack.push ("The");
stack.push ("Pile.");
for (MutantStack<std::string>::iterator it = stack.begin (); it != stack.end (); it++)
std::cout << *it << " ";
std::cout << std::endl;
for (MutantStack<std::string>::reverse_iterator it = stack.rbegin (); it != stack.rend (); it++)
std::cout << *it << " ";
std::cout << std::endl;
return 0;
}