diff options
author | thing 1 <thing1@seacrossedlovers.xyz> | 2024-12-16 13:36:15 +0000 |
---|---|---|
committer | thing 1 <thing1@seacrossedlovers.xyz> | 2024-12-16 13:36:15 +0000 |
commit | 857de9681685bc5cfd3907ccfe87d8a9b160b968 (patch) | |
tree | a2e88494c3931fc4946f6fc4fda1d5f4d9f63247 /comp/lucas-standen-NEA/writeup2/examples/fib/c++/fib.cpp | |
parent | 03625304e740c9c0f7c434833dcded7ecdb9ca99 (diff) |
created example
Diffstat (limited to 'comp/lucas-standen-NEA/writeup2/examples/fib/c++/fib.cpp')
-rw-r--r-- | comp/lucas-standen-NEA/writeup2/examples/fib/c++/fib.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/comp/lucas-standen-NEA/writeup2/examples/fib/c++/fib.cpp b/comp/lucas-standen-NEA/writeup2/examples/fib/c++/fib.cpp new file mode 100644 index 0000000..ce55901 --- /dev/null +++ b/comp/lucas-standen-NEA/writeup2/examples/fib/c++/fib.cpp @@ -0,0 +1,16 @@ +#include <iostream> + +class fibclass { + public: + int run(int n){ + if (n < 2) return n; + return run(n - 1) + run(n - 2); + } +}; + +int main(){ + fibclass obj = fibclass(); + std::cout << obj.run(10); + std::cout << "\n"; +} + |