-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (28 loc) · 672 Bytes
/
Copy pathmain.cpp
File metadata and controls
35 lines (28 loc) · 672 Bytes
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
//
// main.cpp
// algorithms
//
// Created by alifar on 7/29/16.
// Copyright © 2016 alifar. All rights reserved.
//
#include "special_stack.hpp"
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]){
cout << "Special Stack with get_min() method" << endl;
StackWithMin stack;
int item;
cout << "Push several items to a stack: ";
do{
cin >> item;
stack.Push(item);
cout << "Current min: " << stack.get_min() << endl;
} while(cin.get() != '\n');
cout << "Popping items until empty" << endl;
while(!stack.empty()){
cout << "Top of Stack: " << stack.Top() << endl;
stack.Pop();
}
cout << "Done" << endl;
return 0;
}