-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
47 lines (39 loc) · 803 Bytes
/
Copy pathmain.cpp
File metadata and controls
47 lines (39 loc) · 803 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
#include "Span.hpp"
int main()
{
std::srand(std::time(NULL));
Span sp = Span(5);
sp.addNumber(6);
sp.addNumber(3);
sp.addNumber(17);
sp.addNumber(9);
sp.addNumber(11);
std::cout << sp.shortestSpan() << std::endl;
std::cout << sp.longestSpan() << std::endl;
try
{
std::vector<int> test(10000);
std::generate(test.begin(), test.end(), std::rand);
Span span(10000);
span.addNumber(test.begin(), test.end());
std::cout << span.shortestSpan() << std::endl;
std::cout << span.longestSpan() << std::endl;
}
catch (std::exception &e)
{
std::cerr << e.what() << std::endl;
}
try
{
Span span2(3);
span2.addNumber(1);
span2.addNumber(2);
span2.addNumber(3);
span2.addNumber(4);
}
catch (std::exception &e)
{
std::cerr << e.what() << std::endl;
}
return 0;
}