-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (40 loc) · 868 Bytes
/
Copy pathmain.cpp
File metadata and controls
48 lines (40 loc) · 868 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
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "queue.h"
#include <iostream>
int main()
{
const int N = 2;
queue::Queue<int, N> q;
for (int i = 0; i < 4; i++)
{
try
{
q.enqueue(67 + i);
}
catch (queue::QOverflow &e)
{
std::cout << e.getMessage() << std::endl;
}
}
for (int i = 0; i < 3; i++)
{
try
{
std::cout << q.dequeue() << std::endl;
}
catch (queue::QUnderflow &e)
{
std::cout << e.getMessage() << std::endl;
}
}
std::cout << q << std::endl;
std::cout << q.size() << std::endl;
q.enqueue(67);
q.enqueue(68);
int x = 5;
x = cast(float);
queue::Queue<double, N> casted = q.cast<double>();
for (int i = 0; i < N; i++)
{
std::cout << casted.dequeue() << std::endl;
}
}