From e07ad28de93a27f90d3508cc10aef38d2640410e Mon Sep 17 00:00:00 2001 From: "v.ignatkin" Date: Tue, 19 Nov 2024 15:11:31 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=B0=D0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lab_20/Lab_20.sln | 31 ++++++ Lab_20/Lab_20/Lab_20.vcxproj | 140 +++++++++++++++++++++++++++ Lab_20/Lab_20/Lab_20.vcxproj.filters | 37 +++++++ Lab_20/Lab_20/Z_1.cpp | 82 ++++++++++++++++ Lab_20/Lab_20/Z_2.cpp | 69 +++++++++++++ Lab_20/Lab_20/Z_3.cpp | 72 ++++++++++++++ Lab_20/Lab_20/Z_4.cpp | 69 +++++++++++++ Lab_20/Lab_20/Z_5.cpp | 79 +++++++++++++++ Lab_20/Lab_20/Z_6.cpp | 79 +++++++++++++++ 9 files changed, 658 insertions(+) create mode 100644 Lab_20/Lab_20.sln create mode 100644 Lab_20/Lab_20/Lab_20.vcxproj create mode 100644 Lab_20/Lab_20/Lab_20.vcxproj.filters create mode 100644 Lab_20/Lab_20/Z_1.cpp create mode 100644 Lab_20/Lab_20/Z_2.cpp create mode 100644 Lab_20/Lab_20/Z_3.cpp create mode 100644 Lab_20/Lab_20/Z_4.cpp create mode 100644 Lab_20/Lab_20/Z_5.cpp create mode 100644 Lab_20/Lab_20/Z_6.cpp diff --git a/Lab_20/Lab_20.sln b/Lab_20/Lab_20.sln new file mode 100644 index 0000000..520a9fb --- /dev/null +++ b/Lab_20/Lab_20.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lab_20", "Lab_20\Lab_20.vcxproj", "{8BE85FFB-DD91-4119-BB66-A3D2B505E650}" +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 + {8BE85FFB-DD91-4119-BB66-A3D2B505E650}.Debug|x64.ActiveCfg = Debug|x64 + {8BE85FFB-DD91-4119-BB66-A3D2B505E650}.Debug|x64.Build.0 = Debug|x64 + {8BE85FFB-DD91-4119-BB66-A3D2B505E650}.Debug|x86.ActiveCfg = Debug|Win32 + {8BE85FFB-DD91-4119-BB66-A3D2B505E650}.Debug|x86.Build.0 = Debug|Win32 + {8BE85FFB-DD91-4119-BB66-A3D2B505E650}.Release|x64.ActiveCfg = Release|x64 + {8BE85FFB-DD91-4119-BB66-A3D2B505E650}.Release|x64.Build.0 = Release|x64 + {8BE85FFB-DD91-4119-BB66-A3D2B505E650}.Release|x86.ActiveCfg = Release|Win32 + {8BE85FFB-DD91-4119-BB66-A3D2B505E650}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BD29D65A-3B89-43F1-A036-5AEDE6CC37A0} + EndGlobalSection +EndGlobal diff --git a/Lab_20/Lab_20/Lab_20.vcxproj b/Lab_20/Lab_20/Lab_20.vcxproj new file mode 100644 index 0000000..1fa6b59 --- /dev/null +++ b/Lab_20/Lab_20/Lab_20.vcxproj @@ -0,0 +1,140 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {8be85ffb-dd91-4119-bb66-a3d2b505e650} + Lab20 + 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_20/Lab_20/Lab_20.vcxproj.filters b/Lab_20/Lab_20/Lab_20.vcxproj.filters new file mode 100644 index 0000000..2ed787a --- /dev/null +++ b/Lab_20/Lab_20/Lab_20.vcxproj.filters @@ -0,0 +1,37 @@ + + + + + {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/Lab_20/Lab_20/Z_1.cpp b/Lab_20/Lab_20/Z_1.cpp new file mode 100644 index 0000000..7745dd6 --- /dev/null +++ b/Lab_20/Lab_20/Z_1.cpp @@ -0,0 +1,82 @@ +//#define _CRT_SECURE_NO_WARNINGS +// +//#include +//#include +// +//struct Node { +// int data; +// struct Node* next; +//}; +// +// +//struct Node* first = NULL; +// +//void printList() { +// struct Node* ptr = first; +// while (ptr != NULL) { +// printf("(%d) -> ", ptr->data); +// ptr = ptr->next; +// } +// printf("NULL\n"); +//} +// +//void addToHead(int value) { +// struct Node* newNode = (struct Node*)malloc(sizeof(struct Node)); +// +// newNode->next = first; +// newNode->data = value; +// +// first = newNode; +//} +// +//int deleteFromHead() { +// int value = first->data; +// struct Node* delNode = first; +// first = first->next; +// free(delNode); +// return value; +//} +// +//int contains(int value) { +// struct Node* ptr = first; +// while (ptr != NULL) { +// if (ptr->data == value) { +// return 1; +// } +// ptr = ptr->next; +// } +// return 0; +//} +// +//void clearList() { +// while (first != NULL) +// { +// struct Node* delNode = first; +// first = first->next; +// free(delNode); +// } +//} +// +// +//void main() { +// first = NULL; +// printList(); +// +// addToHead(400); +// addToHead(300); +// addToHead(200); +// addToHead(100); +// deleteFromHead(); +// printList(); +// +// printf("contains(100) = %d\n", contains(100)); +// printf("contains(150) = %d\n", contains(150)); +// printf("contains(200) = %d\n", contains(200)); +// +// clearList(); +// printList(); +// +// printf("contains(100)(NULL) = %d\n", contains(100)); +// printf("contains(150)(NULL) = %d\n", contains(150)); +// printf("contains(200)(NULL) = %d\n", contains(200)); +//} diff --git a/Lab_20/Lab_20/Z_2.cpp b/Lab_20/Lab_20/Z_2.cpp new file mode 100644 index 0000000..497f52f --- /dev/null +++ b/Lab_20/Lab_20/Z_2.cpp @@ -0,0 +1,69 @@ +//#define _crt_secure_no_warnings +// +//#include +//#include +// +//struct node { +// int data; +// struct node* next; +//}; +// +// +//struct node* first = NULL; +// +//void printlist() { +// struct node* ptr = first; +// while (ptr != NULL) { +// printf("(%d) -> ", ptr->data); +// ptr = ptr->next; +// } +// printf("null\n"); +//} +// +//void addtohead(int value) { +// struct node* newnode = (struct node*)malloc(sizeof(struct node)); +// +// newnode->next = first; +// newnode->data = value; +// +// first = newnode; +//} +// +//int sum() { +// int s = 0; +// struct node* ptr = first; +// while (ptr != NULL) { +// s += ptr->data; +// ptr = ptr->next; +// } +// return s; +//} +// +//void clearlist() { +// while (first != NULL) +// { +// struct node* delnode = first; +// first = first->next; +// free(delnode); +// } +//} +// +// +//void main() { +// first = NULL; +// printlist(); +// +// addtohead(1); +// addtohead(3); +// addtohead(6); +// addtohead(9); +// printlist(); +// +// printf("sum = %d\n", sum()); +// +// clearlist(); +// printlist(); +// +// printf("sum(null) = %d\n", sum()); +// +//} diff --git a/Lab_20/Lab_20/Z_3.cpp b/Lab_20/Lab_20/Z_3.cpp new file mode 100644 index 0000000..7d17d93 --- /dev/null +++ b/Lab_20/Lab_20/Z_3.cpp @@ -0,0 +1,72 @@ +//#define _CRT_SECURE_NO_WARNINGS +// +//#include +//#include +// +//struct Node { +// int data; +// struct Node* next; +//}; +// +// +//struct Node* first = NULL; +// +//void printList() { +// struct Node* ptr = first; +// while (ptr != NULL) { +// printf("(%d) -> ", ptr->data); +// ptr = ptr->next; +// } +// printf("NULL\n"); +//} +// +//void addToHead(int value) { +// struct Node* newNode = (struct Node*)malloc(sizeof(struct Node)); +// +// newNode->next = first; +// newNode->data = value; +// +// first = newNode; +//} +// +//int evcnt() { +// struct Node* ptr = first; +// int count = 0; +// while (ptr != NULL) { +// if (ptr->data % 2 == 0) { +// count++; +// +// } +// ptr = ptr->next; +// } +// return count; +//} +// +//void clearList() { +// while (first != NULL) +// { +// struct Node* delNode = first; +// first = first->next; +// free(delNode); +// } +//} +// +// +//void main() { +// first = NULL; +// printList(); +// +// addToHead(2); +// addToHead(3); +// addToHead(6); +// addToHead(4); +// printList(); +// +// printf("Even Num = %d\n", evcnt()); +// +// clearList(); +// printList(); +// +// printf("Even Num(Null) = %d\n", evcnt()); +// +//} diff --git a/Lab_20/Lab_20/Z_4.cpp b/Lab_20/Lab_20/Z_4.cpp new file mode 100644 index 0000000..826d39d --- /dev/null +++ b/Lab_20/Lab_20/Z_4.cpp @@ -0,0 +1,69 @@ +//#define _CRT_SECURE_NO_WARNINGS +// +//#include +//#include +// +//struct Node { +// int data; +// struct Node* next; +//}; +// +// +//struct Node* first = NULL; +// +//void printList() { +// struct Node* ptr = first; +// while (ptr != NULL) { +// printf("(%d) -> ", ptr->data); +// ptr = ptr->next; +// } +// printf("NULL\n"); +//} +// +//void addToHead(int value) { +// struct Node* newNode = (struct Node*)malloc(sizeof(struct Node)); +// +// newNode->next = first; +// newNode->data = value; +// +// first = newNode; +//} +// +//void oddsX10() { +// struct Node* ptr = first; +// while (ptr != NULL) { +// if (ptr->data % 2 != 0) { +// ptr->data *= 2; +// } +// ptr = ptr->next; +// } +//} +// +//void clearList() { +// while (first != NULL) +// { +// struct Node* delNode = first; +// first = first->next; +// free(delNode); +// } +//} +// +// +//void main() { +// first = NULL; +// printList(); +// +// addToHead(2); +// addToHead(3); +// addToHead(6); +// addToHead(9); +// printList(); +// +// oddsX10(); +// printList(); +// +// clearList(); +// printList(); +// +// +//} diff --git a/Lab_20/Lab_20/Z_5.cpp b/Lab_20/Lab_20/Z_5.cpp new file mode 100644 index 0000000..276915a --- /dev/null +++ b/Lab_20/Lab_20/Z_5.cpp @@ -0,0 +1,79 @@ +//#define _CRT_SECURE_NO_WARNINGS +// +//#include +//#include +// +//struct Node { +// int data; +// struct Node* next; +//}; +// +// +//struct Node* first = NULL; +// +//void printList() { +// struct Node* ptr = first; +// while (ptr != NULL) { +// printf("(%d) -> ", ptr->data); +// ptr = ptr->next; +// } +// printf("NULL\n"); +//} +// +//void addToHead(int value) { +// struct Node* newNode = (struct Node*)malloc(sizeof(struct Node)); +// +// newNode->next = first; +// newNode->data = value; +// +// first = newNode; +//} +// +//void elIx100(int value) { +// struct Node* ptr = first; +// int i = 0; +// while (ptr != NULL) { +// if (i == value) { +// ptr->data *= 100; +// } +// ptr = ptr->next; +// i++; +// } +//} +// +//void clearList() { +// while (first != NULL) +// { +// struct Node* delNode = first; +// first = first->next; +// free(delNode); +// } +//} +// +// +//void main() { +// first = NULL; +// printList(); +// +// addToHead(1); +// addToHead(3); +// addToHead(6); +// addToHead(8); +// printList(); +// +// printf("-------------------------------------------\n"); +// +// elIx100(0); +// printList(); +// +// elIx100(2); +// printList(); +// +// elIx100(0); +// printList(); +// +// clearList(); +// printList(); +// +// +//} diff --git a/Lab_20/Lab_20/Z_6.cpp b/Lab_20/Lab_20/Z_6.cpp new file mode 100644 index 0000000..27dbecc --- /dev/null +++ b/Lab_20/Lab_20/Z_6.cpp @@ -0,0 +1,79 @@ +#define _CRT_SECURE_NO_WARNINGS + +#include +#include + +struct Node { + int data; + struct Node* next; +}; + + +struct Node* first = NULL; + +void printList() { + struct Node* ptr = first; + while (ptr != NULL) { + printf("(%d) -> ", ptr->data); + ptr = ptr->next; + } + printf("NULL\n"); +} + +void addToHead(int value) { + struct Node* newNode = (struct Node*)malloc(sizeof(struct Node)); + + newNode->next = first; + newNode->data = value; + + first = newNode; +} + +void elLeftIx10(int value) { + struct Node* ptr = first; + int i = 0; + while (ptr != NULL) { + if (i < value) { + ptr->data *= 10; + } + ptr = ptr->next; + i++; + } +} + +void clearList() { + while (first != NULL) + { + struct Node* delNode = first; + first = first->next; + free(delNode); + } +} + + +void main() { + first = NULL; + printList(); + + addToHead(1); + addToHead(3); + addToHead(6); + addToHead(8); + printList(); + + printf("-------------------------------------------\n"); + + elLeftIx10(1); + printList(); + + elLeftIx10(2); + printList(); + + elLeftIx10(4); + printList(); + + clearList(); + printList(); + + +}