diff --git a/lr20/lr20.sln b/lr20/lr20.sln new file mode 100644 index 0000000..786fd21 --- /dev/null +++ b/lr20/lr20.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}") = "lr20", "lr20\lr20.vcxproj", "{C7CF3B85-9900-4577-AA35-CDEDE8372CA0}" +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 + {C7CF3B85-9900-4577-AA35-CDEDE8372CA0}.Debug|x64.ActiveCfg = Debug|x64 + {C7CF3B85-9900-4577-AA35-CDEDE8372CA0}.Debug|x64.Build.0 = Debug|x64 + {C7CF3B85-9900-4577-AA35-CDEDE8372CA0}.Debug|x86.ActiveCfg = Debug|Win32 + {C7CF3B85-9900-4577-AA35-CDEDE8372CA0}.Debug|x86.Build.0 = Debug|Win32 + {C7CF3B85-9900-4577-AA35-CDEDE8372CA0}.Release|x64.ActiveCfg = Release|x64 + {C7CF3B85-9900-4577-AA35-CDEDE8372CA0}.Release|x64.Build.0 = Release|x64 + {C7CF3B85-9900-4577-AA35-CDEDE8372CA0}.Release|x86.ActiveCfg = Release|Win32 + {C7CF3B85-9900-4577-AA35-CDEDE8372CA0}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {10A4D681-EBE0-4FD7-B8C4-B1F341955468} + EndGlobalSection +EndGlobal diff --git a/lr20/lr20/Source.cpp b/lr20/lr20/Source.cpp new file mode 100644 index 0000000..3cf1fb7 --- /dev/null +++ b/lr20/lr20/Source.cpp @@ -0,0 +1,85 @@ +#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"); +} + +int deleteFromHead() { + int value = first->data; + struct Node* delNode = first; + first = first->next; + free(delNode); + return value; +} + + +void addToHead(int value) { + struct Node* newNode = (struct Node*)malloc(sizeof(struct Node)); + + newNode->next = first; + newNode->data = value; + + first = newNode; +} + + +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); + printList(); + + printf("contains(100) = %d\n", contains(100)); + printf("contains(200) = %d\n", contains(200)); + printf("contains(300) = %d\n", contains(300)); + + clearList(); + printList(); + + printf("contains(100) = %d\n", contains(100)); + printf("contains(200) = %d\n", contains(200)); + printf("contains(300) = %d\n", contains(300)); + +} + + +//140706 \ No newline at end of file diff --git a/lr20/lr20/lr20.vcxproj b/lr20/lr20/lr20.vcxproj new file mode 100644 index 0000000..0b27cb6 --- /dev/null +++ b/lr20/lr20/lr20.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {c7cf3b85-9900-4577-aa35-cdede8372ca0} + lr20 + 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/lr20/lr20/lr20.vcxproj.filters b/lr20/lr20/lr20.vcxproj.filters new file mode 100644 index 0000000..ef66db6 --- /dev/null +++ b/lr20/lr20/lr20.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