diff options
| author | Connor McDowell <[email protected]> | 2024-02-24 14:53:54 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-24 14:53:54 -0800 |
| commit | fe61f455b4aabc1dfb30c6303aa8b04449330958 (patch) | |
| tree | 81ec474e09d2873a56969d22f41c4fa22e736e8f | |
| parent | fixed errors, just looking around to help with another assignment (diff) | |
| download | lab-01-connormcdowell275-fe61f455b4aabc1dfb30c6303aa8b04449330958.tar.xz lab-01-connormcdowell275-fe61f455b4aabc1dfb30c6303aa8b04449330958.zip | |
screenshots taken to be added to lab, fibonacci array created
| -rw-r--r-- | Project1/helper.cpp | 14 | ||||
| -rw-r--r-- | Project1/helper.h | 8 | ||||
| -rw-r--r-- | Project1/program.cpp | 2 |
3 files changed, 23 insertions, 1 deletions
diff --git a/Project1/helper.cpp b/Project1/helper.cpp index de05926..a90fc36 100644 --- a/Project1/helper.cpp +++ b/Project1/helper.cpp @@ -43,4 +43,18 @@ void Print(const std::list<int>& myList) std::cout << i << std::endl; } +} + +void Fibonacci(int(&cArray)[SIZE]) +{ + cArray[0] = 0; + cArray[1] = 1; + for (int i = 2; i < SIZE; i++) + { + cArray[i] = cArray[i - 1] + cArray[i - 2]; + } + for (int i = 0; i < SIZE; i++) + { + cout << cArray[i] << " "; + } }
\ No newline at end of file diff --git a/Project1/helper.h b/Project1/helper.h index 7fb2159..cf90d68 100644 --- a/Project1/helper.h +++ b/Project1/helper.h @@ -19,4 +19,12 @@ void Print(const std::vector<int>& myVector); void Print(const std::list<int>& myList); +void Fibonacci(int(&cArray)[SIZE]); + +void Fibonacci(const std::array<int, SIZE>& stdArray); + +void Fibonacci(const std::vector<int>& myVector); + +void Fibonacci(const std::list<int>& myList); + #endif HELPER diff --git a/Project1/program.cpp b/Project1/program.cpp index 0949855..d854cd5 100644 --- a/Project1/program.cpp +++ b/Project1/program.cpp @@ -68,7 +68,7 @@ int main() //createArray(); //createstdArray(); //createVector(); - //Create_list(); + Create_list(); |