From 068912c01202c13dab36e511ca8c4cc2aa8012e9 Mon Sep 17 00:00:00 2001 From: Adelya Date: Thu, 14 Nov 2024 12:41:43 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B2=D1=82=D0=BE=D1=80=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 13, 14/1 лаб 13/1 лаб 13.sln | 31 ++ .../1 лаб 13/1 лаб 13.vcxproj | 147 +++++++++ .../1 лаб 13/1 лаб 13.vcxproj.filters | 22 ++ 13, 14/1 лаб 13/1 лаб 13/Source.cpp | 291 ++++++++++++++++++ 13, 14/14/14.sln | 31 ++ 13, 14/14/14/14.vcxproj | 147 +++++++++ 13, 14/14/14/14.vcxproj.filters | 22 ++ 13, 14/14/14/Source.cpp | 163 ++++++++++ 15, 16/15/Project1.sln | 31 ++ 15, 16/15/Project1/FileName.cpp | 246 +++++++++++++++ 15, 16/15/Project1/Project1.vcxproj | 135 ++++++++ 15, 16/15/Project1/Project1.vcxproj.filters | 22 ++ 15, 16/15/op.txt | 4 + .../1, 2 лаб 10/1 лаб 10.sln | 31 ++ .../1 лаб 10/1 лаб 10.vcxproj | 135 ++++++++ .../1 лаб 10/1 лаб 10.vcxproj.filters | 22 ++ .../1, 2 лаб 10/1 лаб 10/FileName.cpp | 66 ++++ .../1, 2, 3, 5 лаб 9/5 лаб 9.sln | 31 ++ .../5 лаб 9/5 лаб 9.vcxproj | 135 ++++++++ .../5 лаб 9/5 лаб 9.vcxproj.filters | 22 ++ .../5 лаб 9/FileName.cpp | 89 ++++++ 21 files changed, 1823 insertions(+) create mode 100644 13, 14/1 лаб 13/1 лаб 13.sln create mode 100644 13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj create mode 100644 13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj.filters create mode 100644 13, 14/1 лаб 13/1 лаб 13/Source.cpp create mode 100644 13, 14/14/14.sln create mode 100644 13, 14/14/14/14.vcxproj create mode 100644 13, 14/14/14/14.vcxproj.filters create mode 100644 13, 14/14/14/Source.cpp create mode 100644 15, 16/15/Project1.sln create mode 100644 15, 16/15/Project1/FileName.cpp create mode 100644 15, 16/15/Project1/Project1.vcxproj create mode 100644 15, 16/15/Project1/Project1.vcxproj.filters create mode 100644 15, 16/15/op.txt create mode 100644 9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10.sln create mode 100644 9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/1 лаб 10.vcxproj create mode 100644 9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/1 лаб 10.vcxproj.filters create mode 100644 9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/FileName.cpp create mode 100644 9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9.sln create mode 100644 9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/5 лаб 9.vcxproj create mode 100644 9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/5 лаб 9.vcxproj.filters create mode 100644 9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/FileName.cpp diff --git a/13, 14/1 лаб 13/1 лаб 13.sln b/13, 14/1 лаб 13/1 лаб 13.sln new file mode 100644 index 0000000..62f9f29 --- /dev/null +++ b/13, 14/1 лаб 13/1 лаб 13.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.35130.168 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "1 лаб 13", "1 лаб 13\1 лаб 13.vcxproj", "{C42D4451-71EC-412D-9AD6-1FE4A161BA11}" +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 + {C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Debug|x64.ActiveCfg = Debug|x64 + {C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Debug|x64.Build.0 = Debug|x64 + {C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Debug|x86.ActiveCfg = Debug|Win32 + {C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Debug|x86.Build.0 = Debug|Win32 + {C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Release|x64.ActiveCfg = Release|x64 + {C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Release|x64.Build.0 = Release|x64 + {C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Release|x86.ActiveCfg = Release|Win32 + {C42D4451-71EC-412D-9AD6-1FE4A161BA11}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {01E56E1B-5C4E-4F2C-AE54-57C013E36C24} + EndGlobalSection +EndGlobal diff --git a/13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj b/13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj new file mode 100644 index 0000000..01bba55 --- /dev/null +++ b/13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {c42d4451-71ec-412d-9ad6-1fe4a161ba11} + My1лаб13 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + 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/13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj.filters b/13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj.filters new file mode 100644 index 0000000..ef66db6 --- /dev/null +++ b/13, 14/1 лаб 13/1 лаб 13/1 лаб 13.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {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 diff --git a/13, 14/1 лаб 13/1 лаб 13/Source.cpp b/13, 14/1 лаб 13/1 лаб 13/Source.cpp new file mode 100644 index 0000000..b4778c4 --- /dev/null +++ b/13, 14/1 лаб 13/1 лаб 13/Source.cpp @@ -0,0 +1,291 @@ +#include +#include + +#define NUM_ELEMENTS 10 + +int arr[NUM_ELEMENTS]; +int n = 0; + +void printElements() { + int i = 0; + while (i < n) { + printf("%d ", arr[i]); + i++; + } + printf("\n"); +} + +void keyboardInput() { + printf("n = "); + scanf_s("%d", &n); + + printf("input %d values: ", n); + for (int i = 0; i < n; i++) { + scanf_s("%d", &arr[i]); + } +} +void oddsX10(){ + for (int i = 0; i < n; i++) { + if (arr[i] % 2 == 1){ + arr[i] = arr[i] * 10; + } + } +} + +int findMin() { + int min = arr[0]; + for (int i = 0; i < n; i++) { + if (arr[i] < min) { + min = arr[i]; + } + } + return min; +} +int findcnt() { + int cnt = 0; + for (int i = 0; i < n; i++) { + if (arr[i] > 10) { + cnt += 1; + } + } + return cnt; +} +int findchet() { + int index = arr[0]; + for (int i = n - 1 ; i < n; i++) { + if (arr[i] % 2 == 0) { + return i; + } + } + return -1; +} +int findlevo() { + int index = 0; + for (int i = 0; i < n; i++) { + if (arr[i] < arr[index]) { + index = i; + } + } + return index; +} +void findodin() { + for (int i = 0; i < n; i++) { + if (arr[i] % 2 == 0) { + arr[i] *= -1; + } + } +} +void findmenchetr() { + for (int i = 0; i < n; i++) { + if (arr[i] < 4) { + arr[i] = 4; + } + } +} +int findzero() { + int index = 0; + for (int i = 0; i < n; i++) { + if (arr[i] < arr[index]) { + index = i; + } + } + return index; +} +void deleteElement(int index) { + for (int i = index; i < n; i++) { + arr[i] = arr[i + 1]; + } + n--; +} +void insertElement(int index, int value) { + for (int i = n; i > index; i--) { + arr[i] = arr[i - 1]; + } + n++; + arr[index] = value; +} +int findIndexMin() { + int index = 0; + int min = arr[0]; + for (int i = 1; i < n; i++) { + if (arr[i] < min) { + min = arr[i]; + index = i; + } + } + return index; +} +void DelMin(int index) { + for (int i = index; i < n; i++) { + if (arr[i] = findMin()) { + arr[i] = arr[i + 1]; + } + } + n--; +} +void insertMin(int index) { + for (int i = n; i > index; i--) { + if (arr[i] = findMin()) { + arr[i] = arr[i - 1]; + } + } + n++; + arr[index] = 0; +} +int findIndexNech() { + int nechet = arr[0]; + for (int i = 1; i < n; i++) { + if (arr[i] % 2 == 1) { + return i; + } + } + return -1; +} + +void insert0(int index) { + for (int i = n; i < index; i--) { + if (arr[i] = (findIndexNech())) { + arr[i] = arr[i + 1]; + } + } + n++; + arr[index + 1] = 0; +} + +void main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + int item; + + do { + printf("\n"); + printf("------------------------------\n"); + printf(" :"); + printElements(); + printf("\n"); + printf(" :\n"); + printf("1: \n"); + printf("2: x10 \n"); + printf("3: \n"); + printf("4: > 10\n"); + printf("5: x2 \n"); + printf("6: \n"); + printf("7: 1\n"); + printf("8: <4 4\n"); + printf("9: \n"); + printf("10: \n"); + printf("11: \n"); + printf("12: \n"); + printf("13: 0 \n"); + printf("14: 0\n"); + printf("\n"); + printf("0: \n"); + printf(" >>>>>> "); + + scanf_s("%d", &item); + switch (item) { + case 1: + keyboardInput(); + break; + + case 2: + oddsX10(); + break; + + case 3: + { + int min = findMin(); + printf("min = %d\n", min); + } + break; + case 4: + { + int cnt = findcnt(); + printf("cnt = %d\n", cnt); + } + break; + case 5: + { + int index = findchet(); + if (index >= 0) { + arr[index] *= 2; + } + } + break; + case 6: + { + int index = findlevo(); + printf(" = %d\n", index); + + int cnt = 0; + for (int i = 0; i < index; i++) { + if (arr[i] % 2 == 0) { + cnt++; + } + } + printf(" %d \n", cnt); + } + break; + case 7: + findodin(); + break; + + case 8: + findmenchetr(); + break; + case 9: + { + int index = findzero(); + + for (int i = index + 1; i < n; i++) { + arr[i] = 0; + } + } + break; + case 10: + { + printf(" = "); + + int index; + scanf_s(" %d", &index); + + deleteElement(index); + } + break; + case 11: + { + printf(" ? = "); + + int index; + scanf_s(" %d", &index); + + printf(", = ");// + int value; + scanf_s("%d", &value); + + insertElement(index, value); + } + break; + case 12: + { + int index = findIndexMin(); + DelMin(index); + } + break; + case 13: + { + int index = findIndexMin(); + insertMin(index); + } + break; + case 14: + { + int index = findIndexNech(); + insert0(index); + } + + } + + + } while (item != 0); +} \ No newline at end of file diff --git a/13, 14/14/14.sln b/13, 14/14/14.sln new file mode 100644 index 0000000..7c936cd --- /dev/null +++ b/13, 14/14/14.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.35130.168 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "14", "14\14.vcxproj", "{89B3A86D-CAED-4D9E-9812-8AE3FD652597}" +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 + {89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Debug|x64.ActiveCfg = Debug|x64 + {89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Debug|x64.Build.0 = Debug|x64 + {89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Debug|x86.ActiveCfg = Debug|Win32 + {89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Debug|x86.Build.0 = Debug|Win32 + {89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Release|x64.ActiveCfg = Release|x64 + {89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Release|x64.Build.0 = Release|x64 + {89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Release|x86.ActiveCfg = Release|Win32 + {89B3A86D-CAED-4D9E-9812-8AE3FD652597}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F2EAFFED-AE5C-4A15-A70A-559E692E0502} + EndGlobalSection +EndGlobal diff --git a/13, 14/14/14/14.vcxproj b/13, 14/14/14/14.vcxproj new file mode 100644 index 0000000..1eca02e --- /dev/null +++ b/13, 14/14/14/14.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {89b3a86d-caed-4d9e-9812-8ae3fd652597} + My14 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + 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/13, 14/14/14/14.vcxproj.filters b/13, 14/14/14/14.vcxproj.filters new file mode 100644 index 0000000..ef66db6 --- /dev/null +++ b/13, 14/14/14/14.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {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 diff --git a/13, 14/14/14/Source.cpp b/13, 14/14/14/Source.cpp new file mode 100644 index 0000000..62df374 --- /dev/null +++ b/13, 14/14/14/Source.cpp @@ -0,0 +1,163 @@ +#include +#include + +#define NUM_ELEMENTS 10 + +int arr[NUM_ELEMENTS]; +int n = 0; + +void printElements() { + for (int i = 0; i < n; i++) { + printf("%d ", arr[i]); + } +} + +void keyboardInput() { + printf("n = "); + scanf_s("%d", &n); + printf("input %d values: ", n); + + for (int i = 0; i < n; i++) { + scanf_s("%d", &arr[i]); + } +} + + +int findIndexMin() { + int index = 0; + int min = arr[0]; + for (int i = 1; i < n; i++) { + if (arr[i] < min) { + min = arr[i]; + index = i; + } + } + return index; +} + +void delEl(int index) { + for (int i = index; i < n; i++) { + arr[i] = arr[i + 1]; + } + n--; +} + +void insertEl(int index, int a) { + for (int i = n; i > index; i--) { + arr[i] = arr[i - 1]; + } + n++; + arr[index] = a; +} +void DelMin() { + int index = 0; + for (int i = 1; i < n; i++) { + if (arr[i] < arr[index]) { + index = i; + } + } + for (int i = index; i < n - 1; i++) { + arr[i] = arr[i + 1]; + } + n--; +} +void insertMin() { + int index = 0; + for (int i = 1; i < n; i++) { + if (arr[i] < arr[index]) { + index = i; + } + } + for (int i = n; i > index; i--) { + arr[i] = arr[i - 1]; + } + arr[index] = 0; + n++; +} +void zadanchet() { + int index; + for (int i = 0; i < n; i++) { + if (arr[i] % 2 == 0) { + index = i; + break; + } + } + for (int i = n; i > index; i--) { + arr[i + 1] = arr[i]; + } + + n++; + arr[index + 1] = 0; +} + +int main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + int item; + do { + printf("\n"); + printf("------------------------------\n"); + printf(" :"); + printElements(); + printf("\n"); + printf("------------------------------\n"); + printf(" :\n"); + printf("1: \n"); + printf("2: \n"); + printf("3: \n"); + printf("4: \n"); + printf("5: 0 \n"); + printf("6: 0.\n"); + printf("\n"); + printf("0: \n"); + printf("------------------------------\n"); + printf(" >>>>>> "); + + scanf_s("%d", &item); + switch (item) { + case 1: + keyboardInput(); + break; + case 2: + { + printf(" = "); + int index; + scanf_s("%d", &index); + delEl(index); + } + break; + case 3: + { + printf(" = "); + int index; + scanf_s("%d", &index); + printf(" = "); + int a; + scanf_s("%d", &a); + insertEl(index, a); + } + break; + case 4: + DelMin(); + break; + case 5: + insertMin(); + break; + case 6: { + int cnt = 0; + for (int i = 0; i < n; i++){ + if (arr[i] % 2 == 1) { + cnt++; + } + } + if (cnt == n) { + printf(" 1 \n"); + break; + } + } + zadanchet(); + break; + } + } while (item != 0); + return 0; +} \ No newline at end of file diff --git a/15, 16/15/Project1.sln b/15, 16/15/Project1.sln new file mode 100644 index 0000000..c32c145 --- /dev/null +++ b/15, 16/15/Project1.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1\Project1.vcxproj", "{19B5913F-C16A-433C-97EF-5A28AA2C2D61}" +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 + {19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Debug|x64.ActiveCfg = Debug|x64 + {19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Debug|x64.Build.0 = Debug|x64 + {19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Debug|x86.ActiveCfg = Debug|Win32 + {19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Debug|x86.Build.0 = Debug|Win32 + {19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Release|x64.ActiveCfg = Release|x64 + {19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Release|x64.Build.0 = Release|x64 + {19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Release|x86.ActiveCfg = Release|Win32 + {19B5913F-C16A-433C-97EF-5A28AA2C2D61}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {02189D26-7083-4C4E-8219-7EA9BC16A275} + EndGlobalSection +EndGlobal diff --git a/15, 16/15/Project1/FileName.cpp b/15, 16/15/Project1/FileName.cpp new file mode 100644 index 0000000..0e6da29 --- /dev/null +++ b/15, 16/15/Project1/FileName.cpp @@ -0,0 +1,246 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include + + +int n = 3; +int m = 4; +int arr[3][4] = { +{10, 11, 12, 13}, +{20, 21, 9, 23}, +{30, 31, 32, 33} +}; +int arr1[3][4] = { +{10, 11, 12, 13}, +{20, 21, 9, 23}, +{30, 31, 32, 33} +}; +int n1 = 3; +int m1 = 4; + +void print() { + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + printf("%3d ", arr[i][j]); + } + printf("\n"); + } +} +void fillIx10() { + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + arr[i][j] = i * 10 + j; + } + } +} + +void fillZero() { + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + arr[i][j] = 0; + } + } +} + +void randFill0_9() { + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + arr[i][j] = rand() % 10; + } + } +} + +void oddsX10() { + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + if (arr[i][j] % 2 != 0) { + arr[i][j] = arr[i][j] * 10; + } + } + } +} + +void mult10X_10() { + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + if (arr[i][j] % 10 == 0) { + arr[i][j] = arr[i][j] / 10; + } + } + } +} + +void manualPrint() { + printf(" n = "); + scanf_s("%d", &n); + printf("\n m = "); + scanf_s("%d", &m); + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + scanf_s("%d", &arr[i][j]); + } + } +} + +void deleteRow(int delRow) { + for (int i = delRow; i < n - 1; i++) { + for (int j = 0; j < m; j++) { + arr[i][j] = arr[i + 1][j]; + } + } + n--; +} + +void copyColumn(int arr[3][4], int num) { + int addList[3] = { 0, 0, 0 }; + for (int i = 0; i < n1; i++) { + for (int j = 0; j < m1; j++) { + + if (j == num) { + addList[i] = arr[i][j]; + } + } + } + + int arr1[3][5]; + for (int i = 0; i < n1; i++) { + for (int j = 0; j < 5; j++) { + if (j != 4) { + arr1[i][j] = arr[i][j]; + } + else { + arr1[i][j] = addList[i]; + } + } + } + printf("\n"); +} +void devt(int arr[][4], int n, int m) { + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + if (arr[i][j] % 2 == 1) { + int max = arr[i][0]; + for (int k = 1; k < m; k++) { + if (arr[i][k] > max) { + max = arr[i][k]; + } + } + arr[i][j] = max; + } + } + } +} +void save() { + FILE* fout = fopen("C:\\Users\\adely\\source\\repos\\15, 16\\15\\op.txt", "wt"); + if (fout == NULL) { + printf(" \n"); + return; + } + fprintf(fout, "%d ", n); + fprintf(fout, "%d\n", m); + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + fprintf(fout, "%d ", arr[i][j]); + } + fprintf(fout, "\n"); + } + + fclose(fout); +} +void load() { + + FILE* fin = fopen("C:\\Users\\adely\\source\\repos\\15, 16\\15\\\op.txt", "rt"); + if (fin == NULL) { + printf(" "); + return; + } + + fscanf(fin, "%d", &n); + fscanf(fin, "%d", &m); + + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + fscanf(fin, "%d", &arr[i][j]); + } + } + + fclose(fin); +} + + + +void main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + int select; + int delRow, colCopy; + do { + printf("/ / / print() \\ \\ \\ \n"); + print(); + printf("================================================\n"); + printf(" :\n"); + printf("1: i * 10 + j\n"); + printf("2: \n"); + printf("3: \n"); + printf("4: 10 \n"); + printf("5: 10 10 \n"); + printf("6: ( )\n"); + printf("7: \n"); + printf("8: \n"); + printf("9: \n"); + printf("10: \n"); + printf("11: \n"); + printf("\n-1: \n"); + printf("\n : "); + scanf_s("%d", &select); + printf("\n"); + switch (select) { + case 1: + fillIx10(); + break; + case 2: + fillZero(); + break; + case 3: + randFill0_9(); + break; + case 4: + oddsX10(); + break; + case 5: + mult10X_10(); + break; + case 6: + manualPrint(); + break; + case 7: + { + printf(" : "); + scanf_s("%d", &delRow); + deleteRow(delRow); + } + break; + + case 8: + { + int num; + printf(" : "); + scanf_s("%d", &num); + printf("\n"); + copyColumn(arr, num); + } + break; + + case 9: + devt(arr, n, m); + break; + case 10: + save(); + break; + case 11: + load(); + break; + } + } while (select != -1); +} + diff --git a/15, 16/15/Project1/Project1.vcxproj b/15, 16/15/Project1/Project1.vcxproj new file mode 100644 index 0000000..5333585 --- /dev/null +++ b/15, 16/15/Project1/Project1.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {19b5913f-c16a-433c-97ef-5a28aa2c2d61} + Project1 + 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/15, 16/15/Project1/Project1.vcxproj.filters b/15, 16/15/Project1/Project1.vcxproj.filters new file mode 100644 index 0000000..3f0db78 --- /dev/null +++ b/15, 16/15/Project1/Project1.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {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 diff --git a/15, 16/15/op.txt b/15, 16/15/op.txt new file mode 100644 index 0000000..0532b32 --- /dev/null +++ b/15, 16/15/op.txt @@ -0,0 +1,4 @@ +3 4 +10 110 12 130 +20 210 90 230 +30 310 32 330 diff --git a/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10.sln b/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10.sln new file mode 100644 index 0000000..c9629b4 --- /dev/null +++ b/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "1 лаб 10", "1 лаб 10\1 лаб 10.vcxproj", "{180731D8-DD1D-4345-B1DB-ABE639EEDEB0}" +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 + {180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Debug|x64.ActiveCfg = Debug|x64 + {180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Debug|x64.Build.0 = Debug|x64 + {180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Debug|x86.ActiveCfg = Debug|Win32 + {180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Debug|x86.Build.0 = Debug|Win32 + {180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Release|x64.ActiveCfg = Release|x64 + {180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Release|x64.Build.0 = Release|x64 + {180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Release|x86.ActiveCfg = Release|Win32 + {180731D8-DD1D-4345-B1DB-ABE639EEDEB0}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FCF90060-29BF-4992-A986-63ECD2564E38} + EndGlobalSection +EndGlobal diff --git a/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/1 лаб 10.vcxproj b/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/1 лаб 10.vcxproj new file mode 100644 index 0000000..889391a --- /dev/null +++ b/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/1 лаб 10.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {180731d8-dd1d-4345-b1db-abe639eedeb0} + My1лаб10 + 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/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/1 лаб 10.vcxproj.filters b/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/1 лаб 10.vcxproj.filters new file mode 100644 index 0000000..3f0db78 --- /dev/null +++ b/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/1 лаб 10.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {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 diff --git a/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/FileName.cpp b/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/FileName.cpp new file mode 100644 index 0000000..8116195 --- /dev/null +++ b/9, 10 лаб — копия/1, 2 лаб 10/1 лаб 10/FileName.cpp @@ -0,0 +1,66 @@ +#include +#include + +void Task1() { + printf("Task1() START\n"); + int n; + int m; + + printf("n = "); + scanf_s("%d", &n); + printf("m = "); + scanf_s("%d", &m); + + int i = 1; + do { + int j = 1; + do { + printf("%d ", i * 10 + j); + j += 1; + } while (j <= m); + printf("\n"); + i += 1; + } while (i <= n); + printf("Task1() FINISH()\n"); +} + +void Task2() { + printf("Task2() START\n"); + int i = 1;//llll + do { + int j = 1; + do { + printf("%5d ", i * j); + j += 1; + } while (j <= 10); + printf("\n"); + i += 1; + } while (i <= 10); + printf("Task2() FINISH()\n"); +} + +void main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + int n = 1; + + do { + printf("\n"); + printf("\n"); + printf(" \n"); + printf("1: 1 (i * 10 + j)\n"); + printf("2: 2 ( )\n"); + printf("\n"); + printf("0: \n"); + + scanf_s("%d", &n); + switch (n) { + case 1: + Task1(); + break; + case 2: + Task2(); + break; + } + } while (n != 0); +} \ No newline at end of file diff --git a/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9.sln b/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9.sln new file mode 100644 index 0000000..b523521 --- /dev/null +++ b/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "5 лаб 9", "5 лаб 9\5 лаб 9.vcxproj", "{12150A36-9D7F-4F8E-A3A9-745FF77BA796}" +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 + {12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Debug|x64.ActiveCfg = Debug|x64 + {12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Debug|x64.Build.0 = Debug|x64 + {12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Debug|x86.ActiveCfg = Debug|Win32 + {12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Debug|x86.Build.0 = Debug|Win32 + {12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Release|x64.ActiveCfg = Release|x64 + {12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Release|x64.Build.0 = Release|x64 + {12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Release|x86.ActiveCfg = Release|Win32 + {12150A36-9D7F-4F8E-A3A9-745FF77BA796}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {115C7EB3-B988-40B7-ADEE-82FBA1102BC5} + EndGlobalSection +EndGlobal diff --git a/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/5 лаб 9.vcxproj b/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/5 лаб 9.vcxproj new file mode 100644 index 0000000..53a064b --- /dev/null +++ b/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/5 лаб 9.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {12150a36-9d7f-4f8e-a3a9-745ff77ba796} + My5лаб9 + 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/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/5 лаб 9.vcxproj.filters b/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/5 лаб 9.vcxproj.filters new file mode 100644 index 0000000..3f0db78 --- /dev/null +++ b/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/5 лаб 9.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {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 diff --git a/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/FileName.cpp b/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/FileName.cpp new file mode 100644 index 0000000..7815bed --- /dev/null +++ b/9, 10 лаб — копия/1, 2, 3, 5 лаб 9/5 лаб 9/FileName.cpp @@ -0,0 +1,89 @@ +#include +#include + +void print1_10() { + int a = 1; + do { + printf("%d ", a); + a += 1; + } while (a <= 10); +} + +void print10_1() { + int a = 10; + do { + printf("%d ", a); + a -= 1; + } while (a >= 1); +} + +void print5() { + int a = 1; + int i = 1; + do { + printf("%d ", a); + a += 2; + i += 1; + } while (i <= 5); +} +void print100_10while() { + int a = 100; + while (a >= 10) { + printf("%d ", a); + a -= 10; + } +} +void print1000_100while() { + int a = 1000; + while (a >= 100) { + printf("%d ", a); + a -= 100; + } +} +void print1000_0while() { + int a = 1000; + while (a >= 0) { + printf("%d ", a); + a -= 6; + } +} +void main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + int n; + + do { + printf("\n"); + printf("\n"); + printf(" :\n"); + printf("1: 1 10\n"); + printf("2: 10 1\n"); + printf("3: 5 1\n"); + printf("11: 100 90 80 ... 10( WHILE)\n"); + printf("12: 1000 900 800 ... 100( WHILE)\n"); + printf("20: 1000 994 988 ( WHILE)\n"); + printf("\n"); + printf("0: \n"); + scanf_s("%d", &n); + switch (n) { + case 1: + print1_10(); + break; + case 2: + print10_1(); + break; + case 3: + print5(); + break; + case 11: + print100_10while(); + break; + case 12: + print1000_100while(); + break; + case 20: + print1000_0while(); + break; + } + } while (n != 0); +}