diff --git a/cpp_1/main.cpp b/cpp_1/main.cpp index 746af00..5bdc290 100644 --- a/cpp_1/main.cpp +++ b/cpp_1/main.cpp @@ -26,7 +26,7 @@ void readfile(string file) cout << line << '\n'; } - myfile.close(); + myfile.close(); } } diff --git a/cpp_1/testfile.txt b/cpp_1/testfile.txt index e69de29..38b83cd 100644 --- a/cpp_1/testfile.txt +++ b/cpp_1/testfile.txt @@ -0,0 +1,5 @@ +Hallo Welt! +Hallo Welt! +Hallo Welt! +Hallo Welt! +Hallo Welt! diff --git a/fibonacci/fib b/fibonacci/fib new file mode 100755 index 0000000..bc4c386 Binary files /dev/null and b/fibonacci/fib differ diff --git a/fibonacci/main.cpp b/fibonacci/main.cpp new file mode 100644 index 0000000..1be8eec --- /dev/null +++ b/fibonacci/main.cpp @@ -0,0 +1,14 @@ +#include + +int fib(int n) +{ + return n < 2 ? 1 : fib(n-2)+ fib(n-1); +} + +int main() +{ + std::cout << "Geben sie an die wievielte fib. Zahl sie suchen: "; + int n = 0; + std::cin >> n; + std::cout << "fib(" << n << ") = " << fib(n) << "\n"; +} \ No newline at end of file diff --git a/fibonacci/makefile b/fibonacci/makefile new file mode 100644 index 0000000..72eb9b0 --- /dev/null +++ b/fibonacci/makefile @@ -0,0 +1,5 @@ +dev: compile run +compile: + g++ -o fib main.cpp +run: + ./fib \ No newline at end of file