-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (39 loc) · 1.76 KB
/
Copy pathmain.cpp
File metadata and controls
48 lines (39 loc) · 1.76 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dpoveda- <me@izenynn.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/20 01:20:25 by dpoveda- #+# #+# */
/* Updated: 2022/02/20 01:30:03 by dpoveda- ### ########.fr */
/* */
/* ************************************************************************** */
#include "easyfind.hpp"
#include <iostream>
#include <vector>
int main() {
std::vector<int> v;
std::vector<int>::iterator it;
for (int i = 0; i < 10; ++i) {
v.push_back(i * i);
}
std::cout << "Vector:" << std::endl;
for (std::vector<int>::iterator i = v.begin(); i != v.end(); ++i) {
std::cout << *i << std::endl;
}
std::cout << std::endl;
it = easyfind(v, -3);
if (it == v.end()) std::cout << "Not found" << std::endl;
else std::cout << "iterator: " << *it << std::endl;
it = easyfind(v, 2);
if (it == v.end()) std::cout << "Not found" << std::endl;
else std::cout << "iterator: " << *it << std::endl;
it = easyfind(v, 25);
if (it == v.end()) std::cout << "Not found" << std::endl;
else std::cout << "iterator: " << *it << std::endl;
it = easyfind(v, 81);
if (it == v.end()) std::cout << "Not found" << std::endl;
else std::cout << "iterator: " << *it << std::endl;
return 0;
}