forked from ratanparai/cpp-template
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathmain_fib.cc
More file actions
33 lines (28 loc) · 738 Bytes
/
main_fib.cc
File metadata and controls
33 lines (28 loc) · 738 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
/**
* Example main file for C++ starter template
* showcasing using a library target and calling its methods
* By: Ari Saif
*/
#include "src/lib/cpplib.h"
#include <iostream>
#include <map>
#include <vector>
int main() {
// Print Hello world!
CPPLib s;
std::cout << s.PrintHelloWorld() << std::endl;
// Calculate Fibonacci numbers and puts them in a map
std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9};
std::map<int, int> results;
for (const auto i : v) {
int r = s.fib(i);
results[i] = r;
std::cout << "r: " << r << std::endl;
}
// Prints the results
for (auto r : results) {
std::cout << "r.first: " << r.first << ", r.second: " << r.second
<< std::endl;
}
return 0;
}