diff --git a/lab 17/lab 17.sln b/lab 17/lab 17.sln deleted file mode 100644 index dcacf5c..0000000 --- a/lab 17/lab 17.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.12.35506.116 d17.12 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab 17", "lab 17\lab 17.vcxproj", "{81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Debug|x64.ActiveCfg = Debug|x64 - {81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Debug|x64.Build.0 = Debug|x64 - {81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Debug|x86.ActiveCfg = Debug|Win32 - {81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Debug|x86.Build.0 = Debug|Win32 - {81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Release|x64.ActiveCfg = Release|x64 - {81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Release|x64.Build.0 = Release|x64 - {81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Release|x86.ActiveCfg = Release|Win32 - {81B8F5AB-43CC-4E63-B2E3-FE0B10E2DE3D}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/lab 17/lab 17/1.cpp b/lab 17/lab 17/1.cpp deleted file mode 100644 index 34a8076..0000000 --- a/lab 17/lab 17/1.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include -#include -#include - -// 1: -int findMin(int arr[], int n, int minVal) { - if (n == 0) return minVal; - if (arr[n - 1] < minVal) minVal = arr[n - 1]; - return findMin(arr, n - 1, minVal); -} - -// 2: -int sumArray(int arr[], int n) { - if (n == 0) return 0; - return arr[n - 1] + sumArray(arr, n - 1); -} - -// 3: , -int isSorted(int arr[], int n) { - if (n <= 1) return 1; // 1 - if (arr[n - 2] > arr[n - 1]) return 0; // - return isSorted(arr, n - 1); -} - -// 4: -void reverseArray(int arr[], int start, int end) { - if (start >= end) return; - int temp = arr[start]; - arr[start] = arr[end]; - arr[end] = temp; - reverseArray(arr, start + 1, end - 1); -} - -// 5: -int countEven(int arr[], int n) { - if (n == 0) return 0; - return (arr[n - 1] % 2 == 0) + countEven(arr, n - 1); -} - -// 6: -int linearSearch(int arr[], int n, int x) { - if (n == 0) return -1; // - if (arr[n - 1] == x) return n - 1; // - return linearSearch(arr, n - 1, x); -} - -// 7: -int binarySearch(int arr[], int left, int right, int x) { - if (left > right) return -1; // - int mid = left + (right - left) / 2; - if (arr[mid] == x) return mid; - if (arr[mid] > x) return binarySearch(arr, left, mid - 1, x); - return binarySearch(arr, mid + 1, right, x); -} - -// 8: () -int gcd(int a, int b) { - if (b == 0) return a; - return gcd(b, a % b); -} - -// 10: -int fibonacci(int n) { - if (n <= 1) return n; - return fibonacci(n - 1) + fibonacci(n - 2); -} - -// -void printArray(int arr[], int n) { - for (int i = 0; i < n; i++) { - printf("%d ", arr[i]); - } - printf("\n"); -} - -// -int main() { - SetConsoleCP(1251); - SetConsoleOutputCP(1251); - - int arr[] = { 5, 3, 8, 1, 4, 7 }; - int n = sizeof(arr) / sizeof(arr[0]); - - // 1 - printf(" : %d\n", findMin(arr, n, INT_MAX)); - - // 2 - printf(" : %d\n", sumArray(arr, n)); - - // 3 - printf(" : %s\n", isSorted(arr, n) ? "" : ""); - - // 4 - reverseArray(arr, 0, n - 1); - printf(" : "); - printArray(arr, n); - - // 5 - printf(" : %d\n", countEven(arr, n)); - - // 6 - int searchValue = 8; - printf(" %d: %d\n", searchValue, linearSearch(arr, n, searchValue)); - - // 7 - // - int sortedArr[] = { 1, 3, 4, 5, 7, 8 }; // - printf(" %d ( ): %d\n", - searchValue, binarySearch(sortedArr, 0, n - 1, searchValue)); - - // 8 - int a = 42, b = 56; - printf(" %d %d: %d\n", a, b, gcd(a, b)); - - // 10 - int fibIndex = 6; - printf(" %d: %d\n", fibIndex, fibonacci(fibIndex)); - - return 0; -} diff --git a/lab 17/lab 17/2.cpp b/lab 17/lab 17/2.cpp deleted file mode 100644 index b5f51e4..0000000 --- a/lab 17/lab 17/2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -void C(int x3) { - printf("C(%d)", x3); -} - -void B(int x2) { - C(x2); -} - -void A(int x1) { - B(x1); -} - -void main1() { - printf("Hello! It is main()!\n"); - int x = 10; - A(x); -} diff --git a/lab 17/lab 17/lab 17.vcxproj b/lab 17/lab 17/lab 17.vcxproj deleted file mode 100644 index 5a7f191..0000000 --- a/lab 17/lab 17/lab 17.vcxproj +++ /dev/null @@ -1,136 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - Win32Proj - {81b8f5ab-43cc-4e63-b2e3-fe0b10e2de3d} - lab17 - 10.0 - - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - \ No newline at end of file diff --git a/lab 17/lab 17/lab 17.vcxproj.filters b/lab 17/lab 17/lab 17.vcxproj.filters deleted file mode 100644 index 1a8e6a7..0000000 --- a/lab 17/lab 17/lab 17.vcxproj.filters +++ /dev/null @@ -1,25 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Исходные файлы - - - Исходные файлы - - - \ No newline at end of file