diff options
| author | Asahel <[email protected]> | 2024-03-14 08:47:01 -0700 |
|---|---|---|
| committer | Asahel <[email protected]> | 2024-03-14 08:47:01 -0700 |
| commit | 7e2a4a0d639b6c4bc0344ced4c9ce2b23cddeccb (patch) | |
| tree | b0db05ce8a0ed70353cf42146ffad959133bf96b | |
| parent | Changes (diff) | |
| download | lab-01-asahellt-main.tar.xz lab-01-asahellt-main.zip | |
| -rw-r--r-- | Lab1/Lab1.vcxproj | 4 | ||||
| -rw-r--r-- | Lab1/Lab1.vcxproj.filters | 8 | ||||
| -rw-r--r-- | Lab1/Source.cpp | 79 | ||||
| -rw-r--r-- | Lab1/helpers.cpp | 0 | ||||
| -rw-r--r-- | Lab1/helpers.h | 6 |
5 files changed, 97 insertions, 0 deletions
diff --git a/Lab1/Lab1.vcxproj b/Lab1/Lab1.vcxproj index e38ed24..0aabb78 100644 --- a/Lab1/Lab1.vcxproj +++ b/Lab1/Lab1.vcxproj @@ -127,8 +127,12 @@ </Link> </ItemDefinitionGroup> <ItemGroup> + <ClCompile Include="helpers.cpp" /> <ClCompile Include="Source.cpp" /> </ItemGroup> + <ItemGroup> + <ClInclude Include="helpers.h" /> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/Lab1/Lab1.vcxproj.filters b/Lab1/Lab1.vcxproj.filters index 3e7e62e..daebb19 100644 --- a/Lab1/Lab1.vcxproj.filters +++ b/Lab1/Lab1.vcxproj.filters @@ -18,5 +18,13 @@ <ClCompile Include="Source.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="helpers.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="helpers.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/Lab1/Source.cpp b/Lab1/Source.cpp index b3d8541..c7a8e98 100644 --- a/Lab1/Source.cpp +++ b/Lab1/Source.cpp @@ -27,6 +27,85 @@ int main() { myVector[i] = 0; } + const int numElements = 12000; + std::vector<int> + List(numElements); + + void PrintContainer(const int (&arr)) { + + for (size_t i = 0; ++i) { + cout << arr[i] << " "; + } + std::cout << std::endl; + } + + void PrintContainer(const std::array& container) { + for (const auto& element : container) { + cout << element << " "; + } + cout << endl; + } + + void PrintContainer(const std::vector& container) { + for (const auto& element : container) { + cout << element << " "; + } + cout << endl; + } + + void PrintContainer(const std::list& container) { + for (const auto& element : container) { + cout << element << " "; + } + cout << endl; + } + + int fibonacci(int n, int arr[]) { + if (n <= 1) + return n; + + arr[0] = 0; + arr[1] = 1; + + for (int i = 2; i <= n; ++i) + arr[i] = arr[i - 1] + arr[i - 2]; + + return arr[n]; + } + + int fib(array<int, n>& fibarray) { + fibarray[0] = 0; + fibarray[1] = 1; + + for (size_t i = 2; i < N; ++i) + + fibArray[i] = fibarray[i - 1] + fibArray[N - 1]; + + } + + fibVector(int) { + vector<int> fibVector(n + 1); + + fibVector[0] = 0; + fibVector[1] = 1; + + for (int i = 2; i <= n; ++i) + fibVector[i] = fibVector[i - 1] + fibVector[i - 2]; + return fibVector + + } + + fibList(int) { + list<int> fibList; + fibList[0] = [0]; + fibList[1] = [1]; + + for (int i = 2; i <= n; ++i) + + return fibList; + } + + return 0; } diff --git a/Lab1/helpers.cpp b/Lab1/helpers.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Lab1/helpers.cpp diff --git a/Lab1/helpers.h b/Lab1/helpers.h new file mode 100644 index 0000000..3418dc7 --- /dev/null +++ b/Lab1/helpers.h @@ -0,0 +1,6 @@ +#ifndef HELPERS_H +#define HELPERS_H + + + +#endif HELPERS_H
\ No newline at end of file |