-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
55 lines (53 loc) · 1.26 KB
/
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
46
47
48
49
50
51
52
53
54
55
/*
* Lab 7 IT-Academy
* Max @Kruptixx <zexqmap@gmail.com>
*
* Abstract class List and its' inheritors Stack and Queue
*/
#include <iostream>
#include "queue.hpp"
#include "stack.hpp"
#include "stackExtended.hpp"
#ifdef _WIN32
#define CLEARING "cls"
#elif __linux__
#define CLEARING "clear"
#else
#define CLEARING "???"
#endif
// ***MAIN***
int main() {
StackExtended a, b;
Queue c;
c.push(5);
c.push(10);
c.push(36);
c.push(1);
a.push(2);
a.push(4);
a.push(13);
a.push(17);
b.push(8);
b.push(19);
b = a;
std::cout << "A=" << a.sum() << std::endl;
std::cout << a.pop() << std::endl;
std::cout << a.pop() << std::endl;
std::cout << a.pop() << std::endl;
std::cout << a.pop() << std::endl;
try {
a.pop();
} catch(const List<int>::EmptyListException& e) {
std::cout << e.what() << std::endl;
}
std::cout << "\n\nB=" << b.max() << std::endl;
std::cout << b.pop() << std::endl;
std::cout << b.pop() << std::endl;
std::cout << b.pop() << std::endl;
std::cout << b.pop() << std::endl;
std::cout << "\n\nC" << std::endl;
std::cout << c.pop() << std::endl;
std::cout << c.pop() << std::endl;
std::cout << c.pop() << std::endl;
std::cout << c.pop() << std::endl;
}