diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json
new file mode 100644
index 00000000..4e72f3be
--- /dev/null
+++ b/.vs/ProjectSettings.json
@@ -0,0 +1,3 @@
+{
+ "CurrentProjectSetting": "Нет конфигураций"
+}
\ No newline at end of file
diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json
new file mode 100644
index 00000000..352d131a
--- /dev/null
+++ b/.vs/VSWorkspaceState.json
@@ -0,0 +1,7 @@
+{
+ "ExpandedNodes": [
+ ""
+ ],
+ "SelectedNode": "\\TASK_1_HW.sln",
+ "PreviewInSolutionExplorer": false
+}
\ No newline at end of file
diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite
new file mode 100644
index 00000000..2aad0305
Binary files /dev/null and b/.vs/slnx.sqlite differ
diff --git a/FinishedTasks_CW/Arrays/.vs/Arrays/v16/.suo b/FinishedTasks_CW/Arrays/.vs/Arrays/v16/.suo
new file mode 100644
index 00000000..fad9ebdf
Binary files /dev/null and b/FinishedTasks_CW/Arrays/.vs/Arrays/v16/.suo differ
diff --git a/FinishedTasks_CW/Arrays/.vs/Arrays/v16/Browse.VC.db b/FinishedTasks_CW/Arrays/.vs/Arrays/v16/Browse.VC.db
new file mode 100644
index 00000000..e92d01b9
Binary files /dev/null and b/FinishedTasks_CW/Arrays/.vs/Arrays/v16/Browse.VC.db differ
diff --git a/FinishedTasks_CW/Arrays/.vs/Arrays/v16/ipch/AutoPCH/8b2543263bc82a17/MAIN.ipch b/FinishedTasks_CW/Arrays/.vs/Arrays/v16/ipch/AutoPCH/8b2543263bc82a17/MAIN.ipch
new file mode 100644
index 00000000..45a23dc7
Binary files /dev/null and b/FinishedTasks_CW/Arrays/.vs/Arrays/v16/ipch/AutoPCH/8b2543263bc82a17/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Arrays/Arrays.sln b/FinishedTasks_CW/Arrays/Arrays.sln
new file mode 100644
index 00000000..536023fa
--- /dev/null
+++ b/FinishedTasks_CW/Arrays/Arrays.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Arrays", "Arrays\Arrays.vcxproj", "{04C8313D-2525-4837-88EA-FE224822BD0D}"
+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
+ {04C8313D-2525-4837-88EA-FE224822BD0D}.Debug|x64.ActiveCfg = Debug|x64
+ {04C8313D-2525-4837-88EA-FE224822BD0D}.Debug|x64.Build.0 = Debug|x64
+ {04C8313D-2525-4837-88EA-FE224822BD0D}.Debug|x86.ActiveCfg = Debug|Win32
+ {04C8313D-2525-4837-88EA-FE224822BD0D}.Debug|x86.Build.0 = Debug|Win32
+ {04C8313D-2525-4837-88EA-FE224822BD0D}.Release|x64.ActiveCfg = Release|x64
+ {04C8313D-2525-4837-88EA-FE224822BD0D}.Release|x64.Build.0 = Release|x64
+ {04C8313D-2525-4837-88EA-FE224822BD0D}.Release|x86.ActiveCfg = Release|Win32
+ {04C8313D-2525-4837-88EA-FE224822BD0D}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {AC847924-BDE7-42F5-A5BC-26CBB41EFB59}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_CW/Arrays/Arrays/Arrays.vcxproj b/FinishedTasks_CW/Arrays/Arrays/Arrays.vcxproj
new file mode 100644
index 00000000..e45e7a36
--- /dev/null
+++ b/FinishedTasks_CW/Arrays/Arrays/Arrays.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {04c8313d-2525-4837-88ea-fe224822bd0d}
+ Arrays
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_CW/Arrays/Arrays/Arrays.vcxproj.filters b/FinishedTasks_CW/Arrays/Arrays/Arrays.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_CW/Arrays/Arrays/Arrays.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/FinishedTasks_CW/Arrays/Arrays/Arrays.vcxproj.user b/FinishedTasks_CW/Arrays/Arrays/Arrays.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_CW/Arrays/Arrays/Arrays.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_CW/Arrays/Arrays/main.c b/FinishedTasks_CW/Arrays/Arrays/main.c
new file mode 100644
index 00000000..bddbe019
--- /dev/null
+++ b/FinishedTasks_CW/Arrays/Arrays/main.c
@@ -0,0 +1,71 @@
+// Copyright 2021 Ivan Novostroev
+
+/*
+
+
+ :
+ 1. ( )
+ 2.
+ 3. :
+ ;
+ ;
+ ;
+ ;
+ ();
+ : 1 2 3 4 5 6 7 8 ---> 5 6 7 8 1 2 3 4;
+ 1. C .
+ 2. .
+*/
+
+#include
+#define SIZE 10
+#include
+
+int main() {
+ //
+
+ //constant int SizeOfMassive_1 = 10;
+ //int massive_1[SizeOfMassive_1]; ( )
+
+ float massive_2[SIZE] = { 0 }; // ()
+
+ int massive_3[] = { 1, 2, 3, 4, 5 }; //
+
+ printf("%f", massive_2[0]);
+
+ printf("%d", massive_3[2]);
+
+ //
+
+ int* mass; //
+ int size;
+ printf("Vvedite pazmer massiva: \n");
+ scanf_s("%d", &size);
+
+ mass = (int*)malloc(size * sizeof(int));
+
+ float* massF = (float*)malloc(size * sizeof(float));
+
+ //
+ int i;
+ for (i = 0; i < size; i++) {
+ mass[i] = 5;
+ }
+ //
+ mass[size / 2] = 0;
+ //
+
+
+
+ /*
+ i = 0;
+ while (i < size) {
+ mass[i] = 5;
+
+ i++;
+ }
+ */
+ free(mass); //
+ free(massF);
+ return 0;
+}
\ No newline at end of file
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/.suo b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/.suo
new file mode 100644
index 00000000..672e0fbb
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/.suo differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/Browse.VC.db b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/Browse.VC.db
new file mode 100644
index 00000000..d7fdcf3d
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/Browse.VC.db differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/Solution.VC.db b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/Solution.VC.db
new file mode 100644
index 00000000..910812df
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/Solution.VC.db differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/23261c104aabb6ea/MAIN.ipch b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/23261c104aabb6ea/MAIN.ipch
new file mode 100644
index 00000000..189c4637
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/23261c104aabb6ea/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/47c7326091c16003/MAIN.ipch b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/47c7326091c16003/MAIN.ipch
new file mode 100644
index 00000000..515d1d01
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/47c7326091c16003/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/610d30bbac385740/MAIN.ipch b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/610d30bbac385740/MAIN.ipch
new file mode 100644
index 00000000..bcb5ab7d
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/610d30bbac385740/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/88da25dca8bf7966/MAIN.ipch b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/88da25dca8bf7966/MAIN.ipch
new file mode 100644
index 00000000..745f0dcd
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/88da25dca8bf7966/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/96cb7689a136f87e/MAIN.ipch b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/96cb7689a136f87e/MAIN.ipch
new file mode 100644
index 00000000..40d82a9b
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/96cb7689a136f87e/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/a3e0965192de337b/MAIN.ipch b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/a3e0965192de337b/MAIN.ipch
new file mode 100644
index 00000000..09f3c4ca
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/a3e0965192de337b/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/e32bd4ee01d52162/MAIN.ipch b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/e32bd4ee01d52162/MAIN.ipch
new file mode 100644
index 00000000..f4058b43
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/e32bd4ee01d52162/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/f483cb4ce5be49f0/MAIN.ipch b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/f483cb4ce5be49f0/MAIN.ipch
new file mode 100644
index 00000000..a3da03f4
Binary files /dev/null and b/FinishedTasks_CW/Average_of_3_numbers/.vs/Average_of_3_numbers/v16/ipch/AutoPCH/f483cb4ce5be49f0/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Average_of_3_numbers/Average_of_3_numbers.sln b/FinishedTasks_CW/Average_of_3_numbers/Average_of_3_numbers.sln
new file mode 100644
index 00000000..77f7ffbd
--- /dev/null
+++ b/FinishedTasks_CW/Average_of_3_numbers/Average_of_3_numbers.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31624.102
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "average", "average\average.vcxproj", "{11300A82-9D66-4E37-9A0F-A140764E1145}"
+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
+ {11300A82-9D66-4E37-9A0F-A140764E1145}.Debug|x64.ActiveCfg = Debug|x64
+ {11300A82-9D66-4E37-9A0F-A140764E1145}.Debug|x64.Build.0 = Debug|x64
+ {11300A82-9D66-4E37-9A0F-A140764E1145}.Debug|x86.ActiveCfg = Debug|Win32
+ {11300A82-9D66-4E37-9A0F-A140764E1145}.Debug|x86.Build.0 = Debug|Win32
+ {11300A82-9D66-4E37-9A0F-A140764E1145}.Release|x64.ActiveCfg = Release|x64
+ {11300A82-9D66-4E37-9A0F-A140764E1145}.Release|x64.Build.0 = Release|x64
+ {11300A82-9D66-4E37-9A0F-A140764E1145}.Release|x86.ActiveCfg = Release|Win32
+ {11300A82-9D66-4E37-9A0F-A140764E1145}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {DC75768D-0494-4091-91A7-08FE760C1A8D}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_CW/Average_of_3_numbers/average/average.vcxproj b/FinishedTasks_CW/Average_of_3_numbers/average/average.vcxproj
new file mode 100644
index 00000000..fa3ed0bb
--- /dev/null
+++ b/FinishedTasks_CW/Average_of_3_numbers/average/average.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {11300a82-9d66-4e37-9a0f-a140764e1145}
+ average
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_CW/Average_of_3_numbers/average/average.vcxproj.filters b/FinishedTasks_CW/Average_of_3_numbers/average/average.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_CW/Average_of_3_numbers/average/average.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/FinishedTasks_CW/Average_of_3_numbers/average/average.vcxproj.user b/FinishedTasks_CW/Average_of_3_numbers/average/average.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_CW/Average_of_3_numbers/average/average.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_CW/Average_of_3_numbers/average/main.c b/FinishedTasks_CW/Average_of_3_numbers/average/main.c
new file mode 100644
index 00000000..ca657fda
--- /dev/null
+++ b/FinishedTasks_CW/Average_of_3_numbers/average/main.c
@@ -0,0 +1,27 @@
+#include
+#include
+#include
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+
+ float a, b, c;
+ float Result_1, Result_2, Result_3, Result_4;
+
+ printf(" 3 :\na = ");
+ scanf_s("%f", &a);
+ printf("b = ");
+ scanf_s("%f", &b);
+ printf("c = ");
+ scanf_s("%f", &c);
+
+ Result_1 = (a + b + c) / 3;
+ Result_2 = (pow(a, 2) + pow(b, 2) + pow(c, 2)) / 3;
+ Result_3 = (abs(a) + abs(b) + abs(c)) / 3;
+ Result_4 = (sqrt(a) + sqrt(b) + sqrt(c)) / 3;
+
+ printf("C = %.2f\n\n", Result_1);
+ printf("C = %.2f\n\n", Result_2);
+ printf("C ( ) = %.2f\n\n", Result_3);
+ printf("C = %.2f\n\n", Result_4);
+}
\ No newline at end of file
diff --git a/FinishedTasks_CW/ClassTest/.vs/ClassTest/v16/.suo b/FinishedTasks_CW/ClassTest/.vs/ClassTest/v16/.suo
new file mode 100644
index 00000000..dadceb0f
Binary files /dev/null and b/FinishedTasks_CW/ClassTest/.vs/ClassTest/v16/.suo differ
diff --git a/FinishedTasks_CW/ClassTest/.vs/ClassTest/v16/Browse.VC.db b/FinishedTasks_CW/ClassTest/.vs/ClassTest/v16/Browse.VC.db
new file mode 100644
index 00000000..5812a134
Binary files /dev/null and b/FinishedTasks_CW/ClassTest/.vs/ClassTest/v16/Browse.VC.db differ
diff --git a/FinishedTasks_CW/ClassTest/.vs/ClassTest/v16/ipch/AutoPCH/f1f1c26e1b2cbc83/MAIN.ipch b/FinishedTasks_CW/ClassTest/.vs/ClassTest/v16/ipch/AutoPCH/f1f1c26e1b2cbc83/MAIN.ipch
new file mode 100644
index 00000000..24d21c54
Binary files /dev/null and b/FinishedTasks_CW/ClassTest/.vs/ClassTest/v16/ipch/AutoPCH/f1f1c26e1b2cbc83/MAIN.ipch differ
diff --git a/FinishedTasks_CW/ClassTest/ClassTest.sln b/FinishedTasks_CW/ClassTest/ClassTest.sln
new file mode 100644
index 00000000..bc448389
--- /dev/null
+++ b/FinishedTasks_CW/ClassTest/ClassTest.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClassTest", "ClassTest\ClassTest.vcxproj", "{D86D4F08-FC02-498D-9DC5-6EC0A9977D79}"
+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
+ {D86D4F08-FC02-498D-9DC5-6EC0A9977D79}.Debug|x64.ActiveCfg = Debug|x64
+ {D86D4F08-FC02-498D-9DC5-6EC0A9977D79}.Debug|x64.Build.0 = Debug|x64
+ {D86D4F08-FC02-498D-9DC5-6EC0A9977D79}.Debug|x86.ActiveCfg = Debug|Win32
+ {D86D4F08-FC02-498D-9DC5-6EC0A9977D79}.Debug|x86.Build.0 = Debug|Win32
+ {D86D4F08-FC02-498D-9DC5-6EC0A9977D79}.Release|x64.ActiveCfg = Release|x64
+ {D86D4F08-FC02-498D-9DC5-6EC0A9977D79}.Release|x64.Build.0 = Release|x64
+ {D86D4F08-FC02-498D-9DC5-6EC0A9977D79}.Release|x86.ActiveCfg = Release|Win32
+ {D86D4F08-FC02-498D-9DC5-6EC0A9977D79}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {92670BB0-22EC-495C-8347-E956C1C2BACD}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_CW/ClassTest/ClassTest/ClassTest.vcxproj b/FinishedTasks_CW/ClassTest/ClassTest/ClassTest.vcxproj
new file mode 100644
index 00000000..01b814d2
--- /dev/null
+++ b/FinishedTasks_CW/ClassTest/ClassTest/ClassTest.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {d86d4f08-fc02-498d-9dc5-6ec0a9977d79}
+ ClassTest
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_CW/ClassTest/ClassTest/ClassTest.vcxproj.filters b/FinishedTasks_CW/ClassTest/ClassTest/ClassTest.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_CW/ClassTest/ClassTest/ClassTest.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/FinishedTasks_CW/ClassTest/ClassTest/ClassTest.vcxproj.user b/FinishedTasks_CW/ClassTest/ClassTest/ClassTest.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_CW/ClassTest/ClassTest/ClassTest.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_CW/ClassTest/ClassTest/main.c b/FinishedTasks_CW/ClassTest/ClassTest/main.c
new file mode 100644
index 00000000..d0517596
--- /dev/null
+++ b/FinishedTasks_CW/ClassTest/ClassTest/main.c
@@ -0,0 +1,55 @@
+#include
+#include
+#include
+#include
+
+int main() {
+
+ char* locale = setlocale(LC_ALL, "");
+
+ int n, a1, a2, k;
+ int* massive;
+
+ printf(" : \n");
+ scanf_s("%d", &n);
+ printf(" : \n");
+ scanf_s("%d", &a1);
+
+ srand(time(0));
+ massive = malloc(n * sizeof(int));;
+ printf(" : \n");
+
+ for (int i = 0; i < n; i++) {
+ massive[i] = rand() % (2 * a1 - 1) - a1;
+ printf(" %d ", massive[i]);
+ }
+
+ printf("\n : \n");
+ scanf_s("%d", &k);
+
+ for (int i = 0; i < k; i++) {
+ int sdvig = massive[n - 1];
+ for (int h = n - 1; h > -1; h--) {
+ massive[h] = massive[h - 1];
+ }
+ massive[0] = sdvig;
+ }
+
+ printf(" : \n");
+ for (int i = 0; i < n; i++) {
+ printf(" %d ", massive[i]);
+ }
+
+ for (int i = 0; i < n / 2; i++) {
+ int per = massive[i];
+ massive[i] = massive[n - i - 1];
+ massive[n - i - 1] = per;
+ }
+
+ printf("\n : \n");
+ for (int i = 0; i < n; i++) {
+ printf(" %d ", massive[i]);
+ }
+
+ return 0;
+}
\ No newline at end of file
diff --git a/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/.suo b/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/.suo
new file mode 100644
index 00000000..cd7eb492
Binary files /dev/null and b/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/.suo differ
diff --git a/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/Browse.VC.db b/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/Browse.VC.db
new file mode 100644
index 00000000..7874f974
Binary files /dev/null and b/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/Browse.VC.db differ
diff --git a/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/ipch/AutoPCH/8036e6bb0e68cc48/MAIN.ipch b/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/ipch/AutoPCH/8036e6bb0e68cc48/MAIN.ipch
new file mode 100644
index 00000000..3d240094
Binary files /dev/null and b/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/ipch/AutoPCH/8036e6bb0e68cc48/MAIN.ipch differ
diff --git a/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/ipch/AutoPCH/c1bf39c843d36a32/MAIN.ipch b/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/ipch/AutoPCH/c1bf39c843d36a32/MAIN.ipch
new file mode 100644
index 00000000..a4a0dcaa
Binary files /dev/null and b/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/ipch/AutoPCH/c1bf39c843d36a32/MAIN.ipch differ
diff --git a/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/ipch/AutoPCH/e99d4a8016f6154f/MAIN.ipch b/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/ipch/AutoPCH/e99d4a8016f6154f/MAIN.ipch
new file mode 100644
index 00000000..3de54ffc
Binary files /dev/null and b/FinishedTasks_CW/ClassTest_1/.vs/ClassTest_1/v16/ipch/AutoPCH/e99d4a8016f6154f/MAIN.ipch differ
diff --git a/FinishedTasks_CW/ClassTest_1/ClassTest_1.sln b/FinishedTasks_CW/ClassTest_1/ClassTest_1.sln
new file mode 100644
index 00000000..bdd0c7af
--- /dev/null
+++ b/FinishedTasks_CW/ClassTest_1/ClassTest_1.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClassTest_1", "ClassTest_1\ClassTest_1.vcxproj", "{956907AD-D0FA-46AE-AB0B-FBB840ABA126}"
+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
+ {956907AD-D0FA-46AE-AB0B-FBB840ABA126}.Debug|x64.ActiveCfg = Debug|x64
+ {956907AD-D0FA-46AE-AB0B-FBB840ABA126}.Debug|x64.Build.0 = Debug|x64
+ {956907AD-D0FA-46AE-AB0B-FBB840ABA126}.Debug|x86.ActiveCfg = Debug|Win32
+ {956907AD-D0FA-46AE-AB0B-FBB840ABA126}.Debug|x86.Build.0 = Debug|Win32
+ {956907AD-D0FA-46AE-AB0B-FBB840ABA126}.Release|x64.ActiveCfg = Release|x64
+ {956907AD-D0FA-46AE-AB0B-FBB840ABA126}.Release|x64.Build.0 = Release|x64
+ {956907AD-D0FA-46AE-AB0B-FBB840ABA126}.Release|x86.ActiveCfg = Release|Win32
+ {956907AD-D0FA-46AE-AB0B-FBB840ABA126}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {8EBDD537-45A2-42A2-B368-BF4BF31B8028}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_CW/ClassTest_1/ClassTest_1/ClassTest_1.vcxproj b/FinishedTasks_CW/ClassTest_1/ClassTest_1/ClassTest_1.vcxproj
new file mode 100644
index 00000000..7857adc9
--- /dev/null
+++ b/FinishedTasks_CW/ClassTest_1/ClassTest_1/ClassTest_1.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+
+
+
+ 16.0
+ Win32Proj
+ {956907ad-d0fa-46ae-ab0b-fbb840aba126}
+ ClassTest1
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_CW/ClassTest_1/ClassTest_1/ClassTest_1.vcxproj.filters b/FinishedTasks_CW/ClassTest_1/ClassTest_1/ClassTest_1.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_CW/ClassTest_1/ClassTest_1/ClassTest_1.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/FinishedTasks_CW/ClassTest_1/ClassTest_1/ClassTest_1.vcxproj.user b/FinishedTasks_CW/ClassTest_1/ClassTest_1/ClassTest_1.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_CW/ClassTest_1/ClassTest_1/ClassTest_1.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_CW/ClassTest_1/ClassTest_1/main.c b/FinishedTasks_CW/ClassTest_1/ClassTest_1/main.c
new file mode 100644
index 00000000..56e432a1
--- /dev/null
+++ b/FinishedTasks_CW/ClassTest_1/ClassTest_1/main.c
@@ -0,0 +1,121 @@
+// Copyright 2021 Novostroev Ivan
+
+#include
+#include
+#include
+#include
+
+int size1 = 0;
+
+void swap(int* array, int indx1, int indx2) {
+ int temp = array[indx1];
+ array[indx1] = array[indx2];
+ array[indx2] = temp;
+}
+
+int evenElem(int* array, int size) {
+ int k = 0;
+ for (int i = 0; i < size; i++) {
+ if (array[i] % 2 == 0) {
+ k++;
+ }
+ }
+ int* copy = (int*)malloc(k * sizeof(int));
+ k = 0;
+ for (int i = 0; i < size; i++) {
+ if (array[i] % 2 == 0) {
+ copy[k] = array[i];
+ k++;
+ }
+ }
+ size1 = k;
+ return copy;
+}
+
+int halfSort(int* array, int size) {
+ int temp;
+ for (int j = 0; j < (size/2 - 1); j++) {
+ for (int i = 0; i < (size / 2 - 1); i++) {
+ if (array[i] > array[i + 1]) {
+ swap(array, i, i + 1);
+ }
+ }
+ }
+ return array;
+}
+
+int plusMinus(int* array, int size) {
+ int k = 0;
+ int* copy = (int*)malloc(size * sizeof(int));
+ for (int i = 0; i < size; i++) {
+ if (array[i] < 0) {
+ copy[k] = array[i];
+ k++;
+ }
+ }
+ for (int i = 0; i < size; i++) {
+ if (array[i] >= 0) {
+ copy[k] = array[i];
+ k++;
+ }
+ }
+ return copy;
+}
+
+int generateRandNumber(int max, int min) {
+ int value = (max - min) * ((float)rand() / RAND_MAX) + min;
+ return value;
+}
+
+void printArray(int* array, int size) {
+ for (int i = 0; i < size; i++) {
+ printf("%d ", array[i]);
+ }
+ printf("\n");
+}
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+
+ srand(time(NULL));
+
+ int* array = NULL;
+ int* array1 = NULL;
+ int* array2 = NULL;
+ int* array3 = NULL;
+ int size = 0;
+ int min, max;
+
+ printf(" : ");
+ scanf_s("%d", &size);
+
+ array = (int*)malloc(size * sizeof(int));
+ array1 = (int*)malloc(size * sizeof(int));
+ array2 = (int*)malloc(size * sizeof(int));
+ array3 = (int*)malloc(size * sizeof(int));
+
+ printf(" : ");
+ scanf_s("%d %d", &min, &max);
+
+ for (int i = 0; i < size; i++) {
+ array[i] = generateRandNumber(max, min);
+ array1[i] = array[i]; array2[i] = array[i]; array3[i] = array[i];
+ }
+
+ printf(" :\n");
+ printArray(array, size);
+
+ printf(" ( ):\n");
+ array1 = evenElem(array1, size);
+ printArray(array1, size1);
+
+ printf(" :\n");
+ array2 = halfSort(array2, size);
+ printArray(array2, size);
+
+ printf(" c :\n");
+ array3 = plusMinus(array3, size);
+ printArray(array3, size);
+
+ return 0;
+}
\ No newline at end of file
diff --git a/FinishedTasks_CW/Inversion/.vs/Inversion/v16/.suo b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/.suo
new file mode 100644
index 00000000..8f26454f
Binary files /dev/null and b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/.suo differ
diff --git a/FinishedTasks_CW/Inversion/.vs/Inversion/v16/Browse.VC.db b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/Browse.VC.db
new file mode 100644
index 00000000..8bb4e040
Binary files /dev/null and b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/Browse.VC.db differ
diff --git a/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/18dd1c5108484c39/MAIN.ipch b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/18dd1c5108484c39/MAIN.ipch
new file mode 100644
index 00000000..506ca9ca
Binary files /dev/null and b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/18dd1c5108484c39/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/3fda734e4ee12356/MAIN_1.ipch b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/3fda734e4ee12356/MAIN_1.ipch
new file mode 100644
index 00000000..473208db
Binary files /dev/null and b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/3fda734e4ee12356/MAIN_1.ipch differ
diff --git a/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/8af899aba6554a05/MAIN.ipch b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/8af899aba6554a05/MAIN.ipch
new file mode 100644
index 00000000..9e7fdd97
Binary files /dev/null and b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/8af899aba6554a05/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/c1ad064ed149c311/MAIN_1.ipch b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/c1ad064ed149c311/MAIN_1.ipch
new file mode 100644
index 00000000..0dfd31ca
Binary files /dev/null and b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/c1ad064ed149c311/MAIN_1.ipch differ
diff --git a/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/c62b873a379e1548/MAIN.ipch b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/c62b873a379e1548/MAIN.ipch
new file mode 100644
index 00000000..b31ef9b9
Binary files /dev/null and b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/c62b873a379e1548/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/d5ee0910a11e888e/MAIN.ipch b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/d5ee0910a11e888e/MAIN.ipch
new file mode 100644
index 00000000..3607fe24
Binary files /dev/null and b/FinishedTasks_CW/Inversion/.vs/Inversion/v16/ipch/AutoPCH/d5ee0910a11e888e/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Inversion/Inversion.sln b/FinishedTasks_CW/Inversion/Inversion.sln
new file mode 100644
index 00000000..a6b2c741
--- /dev/null
+++ b/FinishedTasks_CW/Inversion/Inversion.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Inversion", "Inversion\Inversion.vcxproj", "{E2F989E1-3CE1-41AE-A835-8C8936FDB849}"
+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
+ {E2F989E1-3CE1-41AE-A835-8C8936FDB849}.Debug|x64.ActiveCfg = Debug|x64
+ {E2F989E1-3CE1-41AE-A835-8C8936FDB849}.Debug|x64.Build.0 = Debug|x64
+ {E2F989E1-3CE1-41AE-A835-8C8936FDB849}.Debug|x86.ActiveCfg = Debug|Win32
+ {E2F989E1-3CE1-41AE-A835-8C8936FDB849}.Debug|x86.Build.0 = Debug|Win32
+ {E2F989E1-3CE1-41AE-A835-8C8936FDB849}.Release|x64.ActiveCfg = Release|x64
+ {E2F989E1-3CE1-41AE-A835-8C8936FDB849}.Release|x64.Build.0 = Release|x64
+ {E2F989E1-3CE1-41AE-A835-8C8936FDB849}.Release|x86.ActiveCfg = Release|Win32
+ {E2F989E1-3CE1-41AE-A835-8C8936FDB849}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {28D155EC-0A8F-4E69-9A0B-7765E5FAF33E}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_CW/Inversion/Inversion/Inversion.vcxproj b/FinishedTasks_CW/Inversion/Inversion/Inversion.vcxproj
new file mode 100644
index 00000000..619a1bca
--- /dev/null
+++ b/FinishedTasks_CW/Inversion/Inversion/Inversion.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {e2f989e1-3ce1-41ae-a835-8c8936fdb849}
+ Inversion
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_CW/Inversion/Inversion/Inversion.vcxproj.filters b/FinishedTasks_CW/Inversion/Inversion/Inversion.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_CW/Inversion/Inversion/Inversion.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/FinishedTasks_CW/Inversion/Inversion/Inversion.vcxproj.user b/FinishedTasks_CW/Inversion/Inversion/Inversion.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_CW/Inversion/Inversion/Inversion.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_CW/Inversion/Inversion/main.c b/FinishedTasks_CW/Inversion/Inversion/main.c
new file mode 100644
index 00000000..70efc38f
--- /dev/null
+++ b/FinishedTasks_CW/Inversion/Inversion/main.c
@@ -0,0 +1,60 @@
+#include
+#include
+#include
+#include
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+
+ int isWork = 1;
+ int VariantOfProg, number;
+
+ while (isWork) {
+ printf(" :\n");
+ printf(" ( 1)\n ( 2)\n ( 0)\n");
+ scanf_s("%d", &VariantOfProg);
+ int changeMode = 0;
+
+ if (VariantOfProg == 0) return exit;
+
+ while (!changeMode) {
+ int isError = 0;
+ do {
+ if (isError)
+ printf(" , !\n");
+ printf(" 0 .\n");
+
+ printf(" : \n");
+ scanf_s("%d", &number);
+
+ if (number == 0) {
+ changeMode = 1;
+ break;
+ }
+ isError = (number < 0);
+
+ } while (isError);
+
+ if (changeMode || !isWork) break;
+
+ int result = 0;
+ switch (VariantOfProg) {
+ case 1:
+ do {
+ result = result * 10 + number % 10;
+ number = number / 10;
+ } while (number);
+ break;
+ case 2:
+ do {
+ result = result + number % 10;
+ number = number / 10;
+ } while (number);
+ break;
+ default:
+ break;
+ }
+ printf(" : %d\n", result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.exe.recipe b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.exe.recipe
new file mode 100644
index 00000000..19e3a0cb
--- /dev/null
+++ b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.exe.recipe
@@ -0,0 +1,11 @@
+
+
+
+
+ C:\Users\mrhin\Desktop\Лобач\Инфа ЛАБЫ\Informatics-and-Programming\FinishedTasks_CW\Inversion\x64\Debug\Inversion.exe
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.ilk b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.ilk
new file mode 100644
index 00000000..f5089548
Binary files /dev/null and b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.ilk differ
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.log b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.log
new file mode 100644
index 00000000..e2a92ea7
--- /dev/null
+++ b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.log
@@ -0,0 +1,2 @@
+ main.c
+ Inversion.vcxproj -> C:\Users\mrhin\Desktop\Лобач\Инфа ЛАБЫ\Informatics-and-Programming\FinishedTasks_CW\Inversion\x64\Debug\Inversion.exe
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/CL.command.1.tlog b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/CL.command.1.tlog
new file mode 100644
index 00000000..c4a6fa55
Binary files /dev/null and b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/CL.command.1.tlog differ
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/CL.read.1.tlog b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/CL.read.1.tlog
new file mode 100644
index 00000000..0753801c
Binary files /dev/null and b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/CL.read.1.tlog differ
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/CL.write.1.tlog b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/CL.write.1.tlog
new file mode 100644
index 00000000..c3ffe690
Binary files /dev/null and b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/CL.write.1.tlog differ
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/Inversion.lastbuildstate b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/Inversion.lastbuildstate
new file mode 100644
index 00000000..9a39be58
--- /dev/null
+++ b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/Inversion.lastbuildstate
@@ -0,0 +1,2 @@
+PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:
+Debug|x64|C:\Users\mrhin\Desktop\Лобач\Инфа ЛАБЫ\Informatics-and-Programming\FinishedTasks_CW\Inversion\|
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/link.command.1.tlog b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/link.command.1.tlog
new file mode 100644
index 00000000..3aada186
Binary files /dev/null and b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/link.command.1.tlog differ
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/link.read.1.tlog b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/link.read.1.tlog
new file mode 100644
index 00000000..6143b077
Binary files /dev/null and b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/link.read.1.tlog differ
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/link.write.1.tlog b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/link.write.1.tlog
new file mode 100644
index 00000000..434de1ce
Binary files /dev/null and b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/Inversion.tlog/link.write.1.tlog differ
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/main.obj b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/main.obj
new file mode 100644
index 00000000..0cec8f82
Binary files /dev/null and b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/main.obj differ
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/vc142.idb b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/vc142.idb
new file mode 100644
index 00000000..6caccbb0
Binary files /dev/null and b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/vc142.idb differ
diff --git a/FinishedTasks_CW/Inversion/Inversion/x64/Debug/vc142.pdb b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/vc142.pdb
new file mode 100644
index 00000000..15307186
Binary files /dev/null and b/FinishedTasks_CW/Inversion/Inversion/x64/Debug/vc142.pdb differ
diff --git a/FinishedTasks_CW/Inversion/x64/Debug/Inversion.exe b/FinishedTasks_CW/Inversion/x64/Debug/Inversion.exe
new file mode 100644
index 00000000..11b8e684
Binary files /dev/null and b/FinishedTasks_CW/Inversion/x64/Debug/Inversion.exe differ
diff --git a/FinishedTasks_CW/Inversion/x64/Debug/Inversion.pdb b/FinishedTasks_CW/Inversion/x64/Debug/Inversion.pdb
new file mode 100644
index 00000000..2b98a1d6
Binary files /dev/null and b/FinishedTasks_CW/Inversion/x64/Debug/Inversion.pdb differ
diff --git a/FinishedTasks_CW/MatrixMenu/.vs/MatrixMenu/v16/.suo b/FinishedTasks_CW/MatrixMenu/.vs/MatrixMenu/v16/.suo
new file mode 100644
index 00000000..9ed549bd
Binary files /dev/null and b/FinishedTasks_CW/MatrixMenu/.vs/MatrixMenu/v16/.suo differ
diff --git a/FinishedTasks_CW/MatrixMenu/.vs/MatrixMenu/v16/Browse.VC.db b/FinishedTasks_CW/MatrixMenu/.vs/MatrixMenu/v16/Browse.VC.db
new file mode 100644
index 00000000..3510cf5e
Binary files /dev/null and b/FinishedTasks_CW/MatrixMenu/.vs/MatrixMenu/v16/Browse.VC.db differ
diff --git a/FinishedTasks_CW/MatrixMenu/.vs/MatrixMenu/v16/ipch/AutoPCH/fa95b855672b93db/MAIN.ipch b/FinishedTasks_CW/MatrixMenu/.vs/MatrixMenu/v16/ipch/AutoPCH/fa95b855672b93db/MAIN.ipch
new file mode 100644
index 00000000..2d794432
Binary files /dev/null and b/FinishedTasks_CW/MatrixMenu/.vs/MatrixMenu/v16/ipch/AutoPCH/fa95b855672b93db/MAIN.ipch differ
diff --git a/FinishedTasks_CW/MatrixMenu/MatrixMenu.sln b/FinishedTasks_CW/MatrixMenu/MatrixMenu.sln
new file mode 100644
index 00000000..b8eca383
--- /dev/null
+++ b/FinishedTasks_CW/MatrixMenu/MatrixMenu.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31624.102
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatrixMenu", "MatrixMenu\MatrixMenu.vcxproj", "{E55C41BE-077B-4A3C-A577-BD6CE43F0932}"
+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
+ {E55C41BE-077B-4A3C-A577-BD6CE43F0932}.Debug|x64.ActiveCfg = Debug|x64
+ {E55C41BE-077B-4A3C-A577-BD6CE43F0932}.Debug|x64.Build.0 = Debug|x64
+ {E55C41BE-077B-4A3C-A577-BD6CE43F0932}.Debug|x86.ActiveCfg = Debug|Win32
+ {E55C41BE-077B-4A3C-A577-BD6CE43F0932}.Debug|x86.Build.0 = Debug|Win32
+ {E55C41BE-077B-4A3C-A577-BD6CE43F0932}.Release|x64.ActiveCfg = Release|x64
+ {E55C41BE-077B-4A3C-A577-BD6CE43F0932}.Release|x64.Build.0 = Release|x64
+ {E55C41BE-077B-4A3C-A577-BD6CE43F0932}.Release|x86.ActiveCfg = Release|Win32
+ {E55C41BE-077B-4A3C-A577-BD6CE43F0932}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {F6F5DF19-9EC4-4940-8168-7A4C04B26ADC}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_CW/MatrixMenu/MatrixMenu/MatrixMenu.vcxproj b/FinishedTasks_CW/MatrixMenu/MatrixMenu/MatrixMenu.vcxproj
new file mode 100644
index 00000000..f3d9f945
--- /dev/null
+++ b/FinishedTasks_CW/MatrixMenu/MatrixMenu/MatrixMenu.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {e55c41be-077b-4a3c-a577-bd6ce43f0932}
+ MatrixMenu
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_CW/MatrixMenu/MatrixMenu/MatrixMenu.vcxproj.filters b/FinishedTasks_CW/MatrixMenu/MatrixMenu/MatrixMenu.vcxproj.filters
new file mode 100644
index 00000000..e8deb3dc
--- /dev/null
+++ b/FinishedTasks_CW/MatrixMenu/MatrixMenu/MatrixMenu.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/FinishedTasks_CW/MatrixMenu/MatrixMenu/MatrixMenu.vcxproj.user b/FinishedTasks_CW/MatrixMenu/MatrixMenu/MatrixMenu.vcxproj.user
new file mode 100644
index 00000000..f2f29e84
--- /dev/null
+++ b/FinishedTasks_CW/MatrixMenu/MatrixMenu/MatrixMenu.vcxproj.user
@@ -0,0 +1,6 @@
+
+
+
+ WindowsLocalDebugger
+
+
\ No newline at end of file
diff --git a/FinishedTasks_CW/MatrixMenu/MatrixMenu/main.cpp b/FinishedTasks_CW/MatrixMenu/MatrixMenu/main.cpp
new file mode 100644
index 00000000..129953b0
--- /dev/null
+++ b/FinishedTasks_CW/MatrixMenu/MatrixMenu/main.cpp
@@ -0,0 +1,115 @@
+#include
+#include
+#include
+#include
+#include
+using namespace std;
+
+vector> matrixFiller(int row, int col) {
+ int premenNull = 0;
+ vector > matrix(row);
+ for (int i = 0; i < row; i++)
+ {
+ matrix[i].resize(col);
+ for (int j = 0; j < col; j++) {
+ if (j < premenNull)
+ matrix[i][j] = 0;
+ else matrix[i][j] = rand() % 66;
+ }
+ premenNull += 1;
+ }
+ return matrix;
+}
+
+vector> matrixMulter(vector> matrix1, vector> matrix2, int row1, int col2, int col1) {
+ vector > result (matrixFiller(row1, col2));
+ for (int i = 0; i < row1; i++) {
+ for (int j = 0; j < col2; j++) {
+ result[i][j] = 0;
+ for (int l = 0; l < col1; l++) {
+ result[i][j] += matrix1[i][l] * matrix2[l][j];
+ }
+ }
+ }
+ return result;
+}
+
+vector> matrixTransposition(vector> matrix, int col1, int row1) {
+ vector > result(matrixFiller(col1, row1));
+ for (int i = 0; i < col1; i++) {
+ for (int j = 0; j < row1; j++) {
+ result[i][j] = matrix[j][i];
+ }
+ }
+ return result;
+}
+
+vector> matrixPlus(vector> matrix1, vector> matrix2, int row1, int col1) {
+ vector > result(matrixFiller(row1, col1));
+ for (int i = 0; i < row1; i++) {
+ for (int j = 0; j < col1; j++) {
+ result[i][j] = matrix1[i][j] + matrix2[i][j];
+ }
+ }
+ return result;
+}
+
+vector> matrixMinus(vector> matrix1, vector> matrix2, int row1, int col1) {
+ vector > result(matrixFiller(row1, col1));
+ for (int i = 0; i < row1; i++) {
+ for (int j = 0; j < col1; j++) {
+ result[i][j] = matrix1[i][j] - matrix2[i][j];
+ }
+ }
+ return result;
+}
+
+void matrixPrinter(vector> matrix) {
+ for (int i = 0; i < matrix.size(); ++i)
+ {
+ matrix[i].resize(matrix.size());
+ for (int j = 0; j < matrix.size(); ++j) {
+ cout << matrix[i][j] << "\t ";
+ }
+ cout << endl;
+ }
+}
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+ srand(time(0));
+
+ int rowFirstMatrix, colFirstMitrix;
+ cout << " :" << endl;
+ cin >> rowFirstMatrix;
+ cout << " :" << endl;
+ cin >> colFirstMitrix;
+
+ cout << endl << " 1:" << endl;
+ vector > firstMatrix = matrixFiller(rowFirstMatrix, colFirstMitrix);
+ matrixPrinter(firstMatrix);
+
+ int rowSecondMatrix, colSecondMitrix;
+ cout << endl << " :" << endl;
+ cin >> rowSecondMatrix;
+ cout << " :" << endl;
+ cin >> colSecondMitrix;
+
+ cout << endl << " 2:" << endl;
+ vector > secondMatrix = matrixFiller(rowSecondMatrix, colSecondMitrix);
+ matrixPrinter(secondMatrix);
+
+ cout << endl << " :" << endl;
+ matrixPrinter(matrixMulter(firstMatrix, secondMatrix, rowFirstMatrix, colSecondMitrix, colFirstMitrix));
+
+ cout << endl << " :" << endl;
+ matrixPrinter(matrixTransposition(firstMatrix, colFirstMitrix, rowFirstMatrix));
+
+ cout << endl << " :" << endl;
+ matrixPrinter(matrixPlus(firstMatrix, secondMatrix, rowFirstMatrix, colFirstMitrix));
+
+ cout << endl << " :" << endl;
+ matrixPrinter(matrixMinus(firstMatrix, secondMatrix, rowFirstMatrix, colFirstMitrix));
+
+ return 0;
+}
\ No newline at end of file
diff --git a/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/.suo b/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/.suo
new file mode 100644
index 00000000..78c65045
Binary files /dev/null and b/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/.suo differ
diff --git a/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/Browse.VC.db b/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/Browse.VC.db
new file mode 100644
index 00000000..6b18b470
Binary files /dev/null and b/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/Browse.VC.db differ
diff --git a/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/ipch/AutoPCH/c281348ce408eb85/MAIN.ipch b/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/ipch/AutoPCH/c281348ce408eb85/MAIN.ipch
new file mode 100644
index 00000000..a13e9d1c
Binary files /dev/null and b/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/ipch/AutoPCH/c281348ce408eb85/MAIN.ipch differ
diff --git a/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/ipch/AutoPCH/ea8799c9aeb6c237/MAIN1.ipch b/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/ipch/AutoPCH/ea8799c9aeb6c237/MAIN1.ipch
new file mode 100644
index 00000000..74b86606
Binary files /dev/null and b/FinishedTasks_CW/MatrixOperation/.vs/MatrixOperation/v16/ipch/AutoPCH/ea8799c9aeb6c237/MAIN1.ipch differ
diff --git a/FinishedTasks_CW/MatrixOperation/MatrixOperation.sln b/FinishedTasks_CW/MatrixOperation/MatrixOperation.sln
new file mode 100644
index 00000000..c9196c6a
--- /dev/null
+++ b/FinishedTasks_CW/MatrixOperation/MatrixOperation.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatrixOperation", "MatrixOperation\MatrixOperation.vcxproj", "{FD08FD20-FF48-4385-B9FB-49CB754ABDA1}"
+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
+ {FD08FD20-FF48-4385-B9FB-49CB754ABDA1}.Debug|x64.ActiveCfg = Debug|x64
+ {FD08FD20-FF48-4385-B9FB-49CB754ABDA1}.Debug|x64.Build.0 = Debug|x64
+ {FD08FD20-FF48-4385-B9FB-49CB754ABDA1}.Debug|x86.ActiveCfg = Debug|Win32
+ {FD08FD20-FF48-4385-B9FB-49CB754ABDA1}.Debug|x86.Build.0 = Debug|Win32
+ {FD08FD20-FF48-4385-B9FB-49CB754ABDA1}.Release|x64.ActiveCfg = Release|x64
+ {FD08FD20-FF48-4385-B9FB-49CB754ABDA1}.Release|x64.Build.0 = Release|x64
+ {FD08FD20-FF48-4385-B9FB-49CB754ABDA1}.Release|x86.ActiveCfg = Release|Win32
+ {FD08FD20-FF48-4385-B9FB-49CB754ABDA1}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {2C7D653C-1F53-47BA-9EB8-BF7A44F1F59C}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_CW/MatrixOperation/MatrixOperation/MatrixOperation.vcxproj b/FinishedTasks_CW/MatrixOperation/MatrixOperation/MatrixOperation.vcxproj
new file mode 100644
index 00000000..dfe636c1
--- /dev/null
+++ b/FinishedTasks_CW/MatrixOperation/MatrixOperation/MatrixOperation.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {fd08fd20-ff48-4385-b9fb-49cb754abda1}
+ MatrixOperation
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_CW/MatrixOperation/MatrixOperation/MatrixOperation.vcxproj.filters b/FinishedTasks_CW/MatrixOperation/MatrixOperation/MatrixOperation.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_CW/MatrixOperation/MatrixOperation/MatrixOperation.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/FinishedTasks_CW/MatrixOperation/MatrixOperation/MatrixOperation.vcxproj.user b/FinishedTasks_CW/MatrixOperation/MatrixOperation/MatrixOperation.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_CW/MatrixOperation/MatrixOperation/MatrixOperation.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_CW/MatrixOperation/MatrixOperation/main.c b/FinishedTasks_CW/MatrixOperation/MatrixOperation/main.c
new file mode 100644
index 00000000..fc1a5e53
--- /dev/null
+++ b/FinishedTasks_CW/MatrixOperation/MatrixOperation/main.c
@@ -0,0 +1,238 @@
+// Copyright 2021 Novostroev Ivan
+
+/*
+ .
+
+ , .
+
+ , .
+ .
+ .
+ , , .
+*/
+
+#include
+#include
+#include
+#include
+#include
+
+///
+///
+///
+///
+///
+///
+int generateRandNumber(int max, int min) {
+ int value = min + rand() % (max - min + 1);
+ return value;
+}
+
+///
+///
+///
+///
+///
+///
+int** setMemory(int** matrix, int n, int m) {
+ matrix = (int**)malloc(n * sizeof(int*));
+ for (int i = 0; i < n; i++)
+ matrix[i] = (int*)malloc(m * sizeof(int));
+ return matrix;
+}
+
+///
+///
+///
+///
+///
+///
+void printMatrix(int** matrix, int n, int m) {
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < m; j++) {
+ printf("%d ", matrix[i][j]);
+ }
+ printf("\n");
+ }
+}
+
+///
+///
+///
+/// x
+/// y
+void printVector(int x, int y) {
+ printf("(%d, %d)\n", x, y);
+}
+
+///
+///
+///
+///
+///
+///
+///
+///
+int** multMatrixOnNumber(int** matrix, int n, int m, int* number) {
+ int** res = NULL; // nullptr
+ res = setMemory(res, n, m);
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < m; j++) {
+ res[i][j] = matrix[i][j] * (*number);
+ }
+ }
+ return res;
+}
+
+int** multMatrixOnMatrix(int** matrixA, int** matrixB, int n, int k, int m) {
+ int** res = NULL; // nullptr
+ res = setMemory(res, n, k);
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < k; j++) {
+ res[i][j] = 0;
+ for (int l = 0; l < m; l++) {
+ res[i][j] += matrixA[i][l] * matrixB[l][j];
+ }
+ }
+ }
+ return res;
+}
+
+int** additionMatrix(int** matrixA, int** matrixB, int n, int m) {
+ int** res = NULL; // nullptr
+ res = setMemory(res, n, m);
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < m; j++) {
+ res[i][j] = matrixA[i][j] + matrixB[i][j];
+ }
+ }
+ return res;
+}
+
+int** matrixTransposition(int** matrix, int m, int n) {
+ int** res = NULL; // nullptr
+ res = setMemory(res, m, n);
+ for (int i = 0; i < m; i++) {
+ for (int j = 0; j < n; j++) {
+ res[i][j] = matrix[j][i];
+ }
+ }
+ return res;
+}
+
+void multVectorOnNumber(int x, int y, int value) {
+ int resx = x * value;
+ int resy = y * value;
+ printVector(resx, resy);
+}
+
+void multVectorOnVector(int ax, int ay, int bx, int by) {
+ int resx = ax * bx;
+ int resy = ay * by;
+ printVector(resx, resy);
+}
+
+void additionVectors(int ax, int ay, int bx, int by) {
+ int resx = ax + bx;
+ int resy = ay + by;
+ printVector(resx, resy);
+}
+
+void fillArrayRandValues(int** matrix, int n, int m, int max, int min) {
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < m; j++) {
+ matrix[i][j] = generateRandNumber(max, min);
+ }
+ }
+}
+
+void freeMemory(int** matrix, int n, int m) {
+ for (int i = 0; i < n; i++) free(matrix[i]);
+ free(matrix);
+}
+
+int** createMatrix(int** matrix, int n, int m, int max, int min, char name) {
+ matrix = setMemory(matrix, n, m);
+ fillArrayRandValues(matrix, n, m, max, min);
+ printf("\n %c =\n", name);
+ printMatrix(matrix, n, m);
+ return matrix;
+}
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+
+ int** matrixA = NULL, ** matrixB = NULL, ** result = NULL;
+ int N = 0, M = 0, K = 0;
+ int max = 0, min = 0, value = 0;
+
+ srand(time(0));
+
+ printf(" ( A[N,M] B[M,K] ): ");
+ scanf_s("%d %d %d", &N, &M, &K);
+ printf(" : ");
+ scanf_s("%d %d", &min, &max);
+
+ matrixA = createMatrix(matrixA, N, M, max, min, 'A');
+ matrixB = createMatrix(matrixB, M, K, max, min, 'B');
+ value = generateRandNumber(max, min);
+
+ //
+ result = setMemory(result, N, M);
+ result = multMatrixOnNumber(matrixA, N, M, &value);
+ printf("\nA * %d =\n", value);
+ printMatrix(result, N, M);
+ freeMemory(result, N, M);
+
+ //
+ result = setMemory(result, M, N);
+ result = matrixTransposition(matrixA, M, N);
+ printf("\n A =\n");
+ printMatrix(result, M, N);
+
+ freeMemory(result, M, N);
+
+ //
+ result = setMemory(result, N, K);
+ result = multMatrixOnMatrix(matrixA, matrixB, N, K, M);
+ printf("\nA * B =\n");
+ printMatrix(result, N, K);
+
+ freeMemory(result, N, K);
+
+ //
+ if (N == M && M == K) {
+ result = setMemory(result, N, M);
+ result = additionMatrix(matrixA, matrixB, N, M);
+ printf("\nA + B =\n");
+ printMatrix(result, N, M);
+ freeMemory(result, N, K);
+ }
+ else printf("\n , \n");
+
+ int ax = 0, ay = 0, bx = 0, by = 0;
+ int valueVector = generateRandNumber(max, min);
+
+ printf("\n a ( x, y ) : ");
+ scanf_s("%d %d", &ax, &ay);
+ printf("\n b ( x, y ) : ");
+ scanf_s("%d %d", &bx, &by);
+
+ //
+ printf("\n a * %d = ", valueVector);
+ multVectorOnNumber(ax, ay, valueVector);
+
+ //
+ printf("\n a + b = ");
+ additionVectors(ax, ay, bx, by);
+
+ //
+ printf("\n a * b = ");
+ multVectorOnVector(ax, ay, bx, by);
+
+ //
+ freeMemory(matrixA, N, M);
+ freeMemory(matrixB, M, K);
+
+ return 0;
+}
\ No newline at end of file
diff --git a/FinishedTasks_CW/PloshadiFugyr/.vs/PloshadiFugyr/v16/.suo b/FinishedTasks_CW/PloshadiFugyr/.vs/PloshadiFugyr/v16/.suo
new file mode 100644
index 00000000..423f1eda
Binary files /dev/null and b/FinishedTasks_CW/PloshadiFugyr/.vs/PloshadiFugyr/v16/.suo differ
diff --git a/FinishedTasks_CW/PloshadiFugyr/.vs/PloshadiFugyr/v16/Browse.VC.db b/FinishedTasks_CW/PloshadiFugyr/.vs/PloshadiFugyr/v16/Browse.VC.db
new file mode 100644
index 00000000..24820a53
Binary files /dev/null and b/FinishedTasks_CW/PloshadiFugyr/.vs/PloshadiFugyr/v16/Browse.VC.db differ
diff --git a/FinishedTasks_CW/PloshadiFugyr/.vs/PloshadiFugyr/v16/ipch/AutoPCH/170dd3dba4b34814/MAIN.ipch b/FinishedTasks_CW/PloshadiFugyr/.vs/PloshadiFugyr/v16/ipch/AutoPCH/170dd3dba4b34814/MAIN.ipch
new file mode 100644
index 00000000..02c6c3e3
Binary files /dev/null and b/FinishedTasks_CW/PloshadiFugyr/.vs/PloshadiFugyr/v16/ipch/AutoPCH/170dd3dba4b34814/MAIN.ipch differ
diff --git a/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr.sln b/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr.sln
new file mode 100644
index 00000000..1405c0c3
--- /dev/null
+++ b/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PloshadiFugyr", "PloshadiFugyr\PloshadiFugyr.vcxproj", "{17BDF947-F0D8-4489-BB99-B84E593C4489}"
+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
+ {17BDF947-F0D8-4489-BB99-B84E593C4489}.Debug|x64.ActiveCfg = Debug|x64
+ {17BDF947-F0D8-4489-BB99-B84E593C4489}.Debug|x64.Build.0 = Debug|x64
+ {17BDF947-F0D8-4489-BB99-B84E593C4489}.Debug|x86.ActiveCfg = Debug|Win32
+ {17BDF947-F0D8-4489-BB99-B84E593C4489}.Debug|x86.Build.0 = Debug|Win32
+ {17BDF947-F0D8-4489-BB99-B84E593C4489}.Release|x64.ActiveCfg = Release|x64
+ {17BDF947-F0D8-4489-BB99-B84E593C4489}.Release|x64.Build.0 = Release|x64
+ {17BDF947-F0D8-4489-BB99-B84E593C4489}.Release|x86.ActiveCfg = Release|Win32
+ {17BDF947-F0D8-4489-BB99-B84E593C4489}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {6233C6A4-400E-49BC-8184-4301ECE62119}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/PloshadiFugyr.vcxproj b/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/PloshadiFugyr.vcxproj
new file mode 100644
index 00000000..6bb9cf21
--- /dev/null
+++ b/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/PloshadiFugyr.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {17bdf947-f0d8-4489-bb99-b84e593c4489}
+ PloshadiFugyr
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/PloshadiFugyr.vcxproj.filters b/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/PloshadiFugyr.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/PloshadiFugyr.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/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/PloshadiFugyr.vcxproj.user b/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/PloshadiFugyr.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/PloshadiFugyr.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/main.c b/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/main.c
new file mode 100644
index 00000000..f90f7a41
--- /dev/null
+++ b/FinishedTasks_CW/PloshadiFugyr/PloshadiFugyr/main.c
@@ -0,0 +1,35 @@
+#include
+#define _USE_MATH_DEFINES
+#include
+#include
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+
+ int a_3x, a_4x, b, h, r;
+ float S_1;
+ int S_2;
+ double S_3;
+
+ printf(" 3 :\n");
+ printf(" :\na = ");
+ scanf_s("%d", &a_3x);
+ printf("h = ");
+ scanf_s("%d", &h);
+ printf(" :\na = ");
+ scanf_s("%d", &a_4x);
+ printf("b = ");
+ scanf_s("%d", &b);
+ printf(" :\nr = ");
+ scanf_s("%d", &r);
+
+ S_1 = 0.5 * a_3x * h;
+ S_2 = a_4x * b;
+ S_3 = M_PI * (r*r);
+
+ printf(" : S = %.2f\n", S_1);
+ printf(" : S = %d\n", S_2);
+ printf(" : S = %.2lf\n", S_3);
+
+ return 0;
+}
\ No newline at end of file
diff --git a/FinishedTasks_CW/Witcher/.vs/Witcher/v16/.suo b/FinishedTasks_CW/Witcher/.vs/Witcher/v16/.suo
new file mode 100644
index 00000000..7224547c
Binary files /dev/null and b/FinishedTasks_CW/Witcher/.vs/Witcher/v16/.suo differ
diff --git a/FinishedTasks_CW/Witcher/.vs/Witcher/v16/Browse.VC.db b/FinishedTasks_CW/Witcher/.vs/Witcher/v16/Browse.VC.db
new file mode 100644
index 00000000..4f59b9e0
Binary files /dev/null and b/FinishedTasks_CW/Witcher/.vs/Witcher/v16/Browse.VC.db differ
diff --git a/FinishedTasks_CW/Witcher/.vs/Witcher/v16/ipch/AutoPCH/6189fd1883ce065f/MAIN.ipch b/FinishedTasks_CW/Witcher/.vs/Witcher/v16/ipch/AutoPCH/6189fd1883ce065f/MAIN.ipch
new file mode 100644
index 00000000..d44f487c
Binary files /dev/null and b/FinishedTasks_CW/Witcher/.vs/Witcher/v16/ipch/AutoPCH/6189fd1883ce065f/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Witcher/.vs/Witcher/v16/ipch/AutoPCH/9262e1cd4957f0eb/MAIN.ipch b/FinishedTasks_CW/Witcher/.vs/Witcher/v16/ipch/AutoPCH/9262e1cd4957f0eb/MAIN.ipch
new file mode 100644
index 00000000..6f4cfe14
Binary files /dev/null and b/FinishedTasks_CW/Witcher/.vs/Witcher/v16/ipch/AutoPCH/9262e1cd4957f0eb/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Witcher/.vs/Witcher/v16/ipch/AutoPCH/d67d42a2548ff6af/MAIN.ipch b/FinishedTasks_CW/Witcher/.vs/Witcher/v16/ipch/AutoPCH/d67d42a2548ff6af/MAIN.ipch
new file mode 100644
index 00000000..9d38c203
Binary files /dev/null and b/FinishedTasks_CW/Witcher/.vs/Witcher/v16/ipch/AutoPCH/d67d42a2548ff6af/MAIN.ipch differ
diff --git a/FinishedTasks_CW/Witcher/Witcher.sln b/FinishedTasks_CW/Witcher/Witcher.sln
new file mode 100644
index 00000000..65110870
--- /dev/null
+++ b/FinishedTasks_CW/Witcher/Witcher.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Witcher", "Witcher\Witcher.vcxproj", "{696042DC-1EFB-4A1B-A056-BF3747FA7EB5}"
+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
+ {696042DC-1EFB-4A1B-A056-BF3747FA7EB5}.Debug|x64.ActiveCfg = Debug|x64
+ {696042DC-1EFB-4A1B-A056-BF3747FA7EB5}.Debug|x64.Build.0 = Debug|x64
+ {696042DC-1EFB-4A1B-A056-BF3747FA7EB5}.Debug|x86.ActiveCfg = Debug|Win32
+ {696042DC-1EFB-4A1B-A056-BF3747FA7EB5}.Debug|x86.Build.0 = Debug|Win32
+ {696042DC-1EFB-4A1B-A056-BF3747FA7EB5}.Release|x64.ActiveCfg = Release|x64
+ {696042DC-1EFB-4A1B-A056-BF3747FA7EB5}.Release|x64.Build.0 = Release|x64
+ {696042DC-1EFB-4A1B-A056-BF3747FA7EB5}.Release|x86.ActiveCfg = Release|Win32
+ {696042DC-1EFB-4A1B-A056-BF3747FA7EB5}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {40F3F183-4189-4019-8904-DB35ED549763}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_CW/Witcher/Witcher/Witcher.vcxproj b/FinishedTasks_CW/Witcher/Witcher/Witcher.vcxproj
new file mode 100644
index 00000000..cfeca5e2
--- /dev/null
+++ b/FinishedTasks_CW/Witcher/Witcher/Witcher.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {696042dc-1efb-4a1b-a056-bf3747fa7eb5}
+ Witcher
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_CW/Witcher/Witcher/Witcher.vcxproj.filters b/FinishedTasks_CW/Witcher/Witcher/Witcher.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_CW/Witcher/Witcher/Witcher.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/FinishedTasks_CW/Witcher/Witcher/Witcher.vcxproj.user b/FinishedTasks_CW/Witcher/Witcher/Witcher.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_CW/Witcher/Witcher/Witcher.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_CW/Witcher/Witcher/main.c b/FinishedTasks_CW/Witcher/Witcher/main.c
new file mode 100644
index 00000000..11254cb3
--- /dev/null
+++ b/FinishedTasks_CW/Witcher/Witcher/main.c
@@ -0,0 +1,41 @@
+#include
+#include
+
+int main() {
+
+ char* locale = setlocale(LC_ALL, "");
+
+ int m1 = 25, m2 = 10, m3 = 5, m4 = 1, i = 0, k1 = 0, k2 = 0, k3 = 0, k4 = 0;
+ int price;
+
+ printf(" :\n");
+ scanf_s("%d", &price);
+
+ while (price > 0) {
+ while (price >= m1) {
+ price = price - m1;
+ k1++;
+ i++;
+ }
+ while (price >= m2) {
+ price = price - m2;
+ k2++;
+ i++;
+ }
+ while (price >= m3) {
+ price = price - m3;
+ k3++;
+ i++;
+ }
+ while (price >= m4) {
+ price = price - m4;
+ k4++;
+ i++;
+ }
+ }
+ printf(" : %d\n", i);
+ printf(" :\n");
+ printf("25 = %d, 10 = %d, 5 = %d, 1 = %d\n", k1, k2, k3, k4);
+
+ return 0;
+}
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/.suo b/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/.suo
new file mode 100644
index 00000000..ddddfe68
Binary files /dev/null and b/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/.suo differ
diff --git a/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/Browse.VC.db b/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/Browse.VC.db
new file mode 100644
index 00000000..63c47d36
Binary files /dev/null and b/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/Browse.VC.db differ
diff --git a/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/ipch/AutoPCH/437fbae60454d3a7/MAIN.ipch b/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/ipch/AutoPCH/437fbae60454d3a7/MAIN.ipch
new file mode 100644
index 00000000..8859050e
Binary files /dev/null and b/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/ipch/AutoPCH/437fbae60454d3a7/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/ipch/AutoPCH/c552824b75b29484/MAIN.ipch b/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/ipch/AutoPCH/c552824b75b29484/MAIN.ipch
new file mode 100644
index 00000000..e5931be7
Binary files /dev/null and b/FinishedTasks_HW/Task_0_HW/.vs/Task_0_HW/v16/ipch/AutoPCH/c552824b75b29484/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_0_HW/Task_0_HW.sln b/FinishedTasks_HW/Task_0_HW/Task_0_HW.sln
new file mode 100644
index 00000000..9ac53ae2
--- /dev/null
+++ b/FinishedTasks_HW/Task_0_HW/Task_0_HW.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task_0_HW", "Task_0_HW\Task_0_HW.vcxproj", "{0394F305-EF98-43FF-9FC5-7CC9933E3073}"
+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
+ {0394F305-EF98-43FF-9FC5-7CC9933E3073}.Debug|x64.ActiveCfg = Debug|x64
+ {0394F305-EF98-43FF-9FC5-7CC9933E3073}.Debug|x64.Build.0 = Debug|x64
+ {0394F305-EF98-43FF-9FC5-7CC9933E3073}.Debug|x86.ActiveCfg = Debug|Win32
+ {0394F305-EF98-43FF-9FC5-7CC9933E3073}.Debug|x86.Build.0 = Debug|Win32
+ {0394F305-EF98-43FF-9FC5-7CC9933E3073}.Release|x64.ActiveCfg = Release|x64
+ {0394F305-EF98-43FF-9FC5-7CC9933E3073}.Release|x64.Build.0 = Release|x64
+ {0394F305-EF98-43FF-9FC5-7CC9933E3073}.Release|x86.ActiveCfg = Release|Win32
+ {0394F305-EF98-43FF-9FC5-7CC9933E3073}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {36A73756-6055-4200-A6EC-334BA2F13286}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_HW/Task_0_HW/Task_0_HW/Task_0_HW.vcxproj b/FinishedTasks_HW/Task_0_HW/Task_0_HW/Task_0_HW.vcxproj
new file mode 100644
index 00000000..95afc67b
--- /dev/null
+++ b/FinishedTasks_HW/Task_0_HW/Task_0_HW/Task_0_HW.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {0394f305-ef98-43ff-9fc5-7cc9933e3073}
+ Task0HW
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_HW/Task_0_HW/Task_0_HW/Task_0_HW.vcxproj.filters b/FinishedTasks_HW/Task_0_HW/Task_0_HW/Task_0_HW.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_HW/Task_0_HW/Task_0_HW/Task_0_HW.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/FinishedTasks_HW/Task_0_HW/Task_0_HW/Task_0_HW.vcxproj.user b/FinishedTasks_HW/Task_0_HW/Task_0_HW/Task_0_HW.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_HW/Task_0_HW/Task_0_HW/Task_0_HW.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_0_HW/Task_0_HW/main.c b/FinishedTasks_HW/Task_0_HW/Task_0_HW/main.c
new file mode 100644
index 00000000..5cc1c9d7
--- /dev/null
+++ b/FinishedTasks_HW/Task_0_HW/Task_0_HW/main.c
@@ -0,0 +1,43 @@
+#include
+#include
+#include
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+
+ float coorX_1, coorY_1, r1, coorX_2, coorY_2, r2;
+ float d;
+ printf(" 1:\nx = ");
+ scanf_s("%f", &coorX_1);
+ printf("y = ");
+ scanf_s("%f", &coorY_1);
+ printf(" 1:\nr = ");
+ scanf_s("%f", &r1);
+
+ printf(" 2:\nx = ");
+ scanf_s("%f", &coorX_2);
+ printf("y = ");
+ scanf_s("%f", &coorY_2);
+ printf(" 2:\nr = ");
+ scanf_s("%f", &r2);
+
+ d = sqrt(pow(coorX_2 - coorX_1, 2) + pow(coorY_2 - coorY_1, 2));
+
+ if (d == r1 + r2) {
+ printf(" ");
+ }
+ if (d < r1 + r2) {
+ if (d == 0 && r1 == r2) {
+ printf(" ");
+ }
+ else if (d + r1 < r2 || d + r2 < r1) {
+ printf(" ");
+ }
+ else {
+ printf(" ");
+ }
+ }
+ if (d > r1 + r2) {
+ printf(" ");
+ }
+}
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/.suo b/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/.suo
new file mode 100644
index 00000000..f1bd90f5
Binary files /dev/null and b/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/.suo differ
diff --git a/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/Browse.VC.db b/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/Browse.VC.db
new file mode 100644
index 00000000..e06bc56b
Binary files /dev/null and b/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/Browse.VC.db differ
diff --git a/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/ipch/AutoPCH/658dac71e029b7f4/MAIN.ipch b/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/ipch/AutoPCH/658dac71e029b7f4/MAIN.ipch
new file mode 100644
index 00000000..dbe6849f
Binary files /dev/null and b/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/ipch/AutoPCH/658dac71e029b7f4/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/ipch/AutoPCH/7bc4009726b109f2/MAIN.ipch b/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/ipch/AutoPCH/7bc4009726b109f2/MAIN.ipch
new file mode 100644
index 00000000..1151535f
Binary files /dev/null and b/FinishedTasks_HW/Task_1_HW/.vs/Task_1_HW/v16/ipch/AutoPCH/7bc4009726b109f2/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_1_HW/Task_1_HW.sln b/FinishedTasks_HW/Task_1_HW/Task_1_HW.sln
new file mode 100644
index 00000000..3672e402
--- /dev/null
+++ b/FinishedTasks_HW/Task_1_HW/Task_1_HW.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task_1_HW", "Task_1_HW\Task_1_HW.vcxproj", "{3DBAAACD-D8C1-4F9D-9D89-69A6E0C9F43B}"
+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
+ {3DBAAACD-D8C1-4F9D-9D89-69A6E0C9F43B}.Debug|x64.ActiveCfg = Debug|x64
+ {3DBAAACD-D8C1-4F9D-9D89-69A6E0C9F43B}.Debug|x64.Build.0 = Debug|x64
+ {3DBAAACD-D8C1-4F9D-9D89-69A6E0C9F43B}.Debug|x86.ActiveCfg = Debug|Win32
+ {3DBAAACD-D8C1-4F9D-9D89-69A6E0C9F43B}.Debug|x86.Build.0 = Debug|Win32
+ {3DBAAACD-D8C1-4F9D-9D89-69A6E0C9F43B}.Release|x64.ActiveCfg = Release|x64
+ {3DBAAACD-D8C1-4F9D-9D89-69A6E0C9F43B}.Release|x64.Build.0 = Release|x64
+ {3DBAAACD-D8C1-4F9D-9D89-69A6E0C9F43B}.Release|x86.ActiveCfg = Release|Win32
+ {3DBAAACD-D8C1-4F9D-9D89-69A6E0C9F43B}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {25A8C8C7-74DC-4067-8305-9365E5A6226B}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_HW/Task_1_HW/Task_1_HW/Task_1_HW.vcxproj b/FinishedTasks_HW/Task_1_HW/Task_1_HW/Task_1_HW.vcxproj
new file mode 100644
index 00000000..7b145415
--- /dev/null
+++ b/FinishedTasks_HW/Task_1_HW/Task_1_HW/Task_1_HW.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {3dbaaacd-d8c1-4f9d-9d89-69a6e0c9f43b}
+ Task1HW
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_HW/Task_1_HW/Task_1_HW/Task_1_HW.vcxproj.filters b/FinishedTasks_HW/Task_1_HW/Task_1_HW/Task_1_HW.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_HW/Task_1_HW/Task_1_HW/Task_1_HW.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/FinishedTasks_HW/Task_1_HW/Task_1_HW/Task_1_HW.vcxproj.user b/FinishedTasks_HW/Task_1_HW/Task_1_HW/Task_1_HW.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_HW/Task_1_HW/Task_1_HW/Task_1_HW.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_1_HW/Task_1_HW/main.c b/FinishedTasks_HW/Task_1_HW/Task_1_HW/main.c
new file mode 100644
index 00000000..5b1e98b0
--- /dev/null
+++ b/FinishedTasks_HW/Task_1_HW/Task_1_HW/main.c
@@ -0,0 +1,99 @@
+#include
+#include
+#include
+#include
+
+int main() {
+
+ char* locale = setlocale(LC_ALL, "");
+
+ int CoorX_1, CoorX_2, CoorY_1, CoorY_2, Figure;
+ int count_Queen_da = 0, count_King_da = 0, count_Rook_da = 0, count_Bishop_da = 0, count_Knight_da = 0;
+ int flag = 0;
+
+ printf(" (X, Y):\n");
+ scanf_s("%d %d", &CoorX_1, &CoorY_1);
+ printf(" (X, Y):\n");
+ scanf_s("%d %d", &CoorX_2, &CoorY_2);
+
+ printf(" :\n 1.\n 2.\n 3.\n 4.\n 5.\n ");
+ scanf_s("%d", &Figure);
+
+
+ if ((CoorX_1 == CoorX_2 || CoorY_1 == CoorY_2) || (abs(CoorX_2 - CoorX_1) == abs(CoorY_2 - CoorY_1))) {
+ count_Queen_da++;
+ }
+ if ((abs(CoorX_2 - CoorX_1) == 1 && abs(CoorY_2 - CoorY_1) <= 1) || (abs(CoorY_2 - CoorY_1) == 1 && abs(CoorX_2 - CoorX_1) <= 1)) {
+ count_King_da++;
+ }
+ if (abs(CoorX_2 - CoorX_1) == abs(CoorY_2 - CoorY_1)) {
+ count_Rook_da++;
+ }
+ if (CoorX_1 == CoorX_2 || CoorY_1 == CoorY_2) {
+ count_Bishop_da++;
+ }
+ if (((abs(CoorX_2 - CoorX_1) == 3) && (abs(CoorY_2 - CoorY_1) == 1)) || ((abs(CoorY_2 - CoorY_1) == 3) && (abs(CoorX_2 - CoorX_1) == 1))) {
+ count_Knight_da++;
+ }
+
+ if (Figure == 1) {
+ if (count_Queen_da > 0) {
+ printf(" \n");
+ }
+ else {
+ flag = 1;
+ }
+ }
+ if (Figure == 2) {
+ if (count_King_da) {
+ printf(" \n");
+ }
+ else {
+ flag = 1;
+ }
+ }
+ if (Figure == 3) {
+ if (count_Rook_da > 0) {
+ printf(" \n");
+ }
+ else {
+ flag = 1;
+ }
+ }
+ if (Figure == 4) {
+ if (count_Bishop_da > 0) {
+ printf(" \n");
+ }
+ else {
+ flag = 1;
+ }
+ }
+ if (Figure == 5) {
+ if (count_Knight_da > 0) {
+ printf(" \n");
+ }
+ else {
+ flag = 1;
+ }
+ }
+ if (flag == 1) {
+ printf(" \n");
+ printf(":\n");
+ if (count_King_da > 0) {
+ printf("\n");
+ }
+ if (count_Rook_da > 0) {
+ printf("\n");
+ }
+ if (count_Queen_da > 0) {
+ printf("\n");
+ }
+ if (count_Bishop_da > 0) {
+ printf("\n");
+ }
+ if (count_Knight_da > 0) {
+ printf("\n");
+ }
+ }
+ return 0;
+}
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/.suo b/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/.suo
new file mode 100644
index 00000000..5ec60f99
Binary files /dev/null and b/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/.suo differ
diff --git a/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/Browse.VC.db b/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/Browse.VC.db
new file mode 100644
index 00000000..790ee7be
Binary files /dev/null and b/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/Browse.VC.db differ
diff --git a/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/ipch/AutoPCH/706840f52393107e/MAIN.ipch b/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/ipch/AutoPCH/706840f52393107e/MAIN.ipch
new file mode 100644
index 00000000..12a213ad
Binary files /dev/null and b/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/ipch/AutoPCH/706840f52393107e/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/ipch/AutoPCH/7aef1341b5ff4969/MAIN.ipch b/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/ipch/AutoPCH/7aef1341b5ff4969/MAIN.ipch
new file mode 100644
index 00000000..a8b98f17
Binary files /dev/null and b/FinishedTasks_HW/Task_2_HW/.vs/Task_2_HW/v16/ipch/AutoPCH/7aef1341b5ff4969/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_2_HW/Task_2_HW.sln b/FinishedTasks_HW/Task_2_HW/Task_2_HW.sln
new file mode 100644
index 00000000..463f0a07
--- /dev/null
+++ b/FinishedTasks_HW/Task_2_HW/Task_2_HW.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task_2_HW", "Task_2_HW\Task_2_HW.vcxproj", "{0378B407-33E9-4FC7-BA14-C99E96414ADD}"
+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
+ {0378B407-33E9-4FC7-BA14-C99E96414ADD}.Debug|x64.ActiveCfg = Debug|x64
+ {0378B407-33E9-4FC7-BA14-C99E96414ADD}.Debug|x64.Build.0 = Debug|x64
+ {0378B407-33E9-4FC7-BA14-C99E96414ADD}.Debug|x86.ActiveCfg = Debug|Win32
+ {0378B407-33E9-4FC7-BA14-C99E96414ADD}.Debug|x86.Build.0 = Debug|Win32
+ {0378B407-33E9-4FC7-BA14-C99E96414ADD}.Release|x64.ActiveCfg = Release|x64
+ {0378B407-33E9-4FC7-BA14-C99E96414ADD}.Release|x64.Build.0 = Release|x64
+ {0378B407-33E9-4FC7-BA14-C99E96414ADD}.Release|x86.ActiveCfg = Release|Win32
+ {0378B407-33E9-4FC7-BA14-C99E96414ADD}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {60D55E90-54E2-4E60-8480-78637296866A}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_HW/Task_2_HW/Task_2_HW/Task_2_HW.vcxproj b/FinishedTasks_HW/Task_2_HW/Task_2_HW/Task_2_HW.vcxproj
new file mode 100644
index 00000000..6f1a5f1e
--- /dev/null
+++ b/FinishedTasks_HW/Task_2_HW/Task_2_HW/Task_2_HW.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {0378b407-33e9-4fc7-ba14-c99e96414add}
+ Task2HW
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_HW/Task_2_HW/Task_2_HW/Task_2_HW.vcxproj.filters b/FinishedTasks_HW/Task_2_HW/Task_2_HW/Task_2_HW.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_HW/Task_2_HW/Task_2_HW/Task_2_HW.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/FinishedTasks_HW/Task_2_HW/Task_2_HW/Task_2_HW.vcxproj.user b/FinishedTasks_HW/Task_2_HW/Task_2_HW/Task_2_HW.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_HW/Task_2_HW/Task_2_HW/Task_2_HW.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_2_HW/Task_2_HW/main.c b/FinishedTasks_HW/Task_2_HW/Task_2_HW/main.c
new file mode 100644
index 00000000..6230357f
--- /dev/null
+++ b/FinishedTasks_HW/Task_2_HW/Task_2_HW/main.c
@@ -0,0 +1,32 @@
+#include
+#include
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+
+ char ch, flag = -1;
+ unsigned words = 0;
+ unsigned numbers = 0;
+
+ printf(" ( ENTER):\n");
+
+ while ((ch = getchar()) != EOF) {
+ if (ch == '\n') {
+ break;
+ }
+ if (ch == ' ' || ch == '\t')
+ flag = -1;
+ else if (flag == -1) {
+ if (48 <= ch && ch <= 57) {
+ flag = 1;
+ numbers++;
+ }
+ if ((-128 <= ch && ch <= -17) || ((65 <= ch && ch <= 90) || (97 <= ch && ch <= 122))) {
+ flag = 1;
+ words++;
+ }
+ }
+ }
+ printf(": %u\n", words);
+ printf(": %u\n", numbers);
+}
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/.suo b/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/.suo
new file mode 100644
index 00000000..ec3ffbaa
Binary files /dev/null and b/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/.suo differ
diff --git a/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/Browse.VC.db b/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/Browse.VC.db
new file mode 100644
index 00000000..e92184e3
Binary files /dev/null and b/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/Browse.VC.db differ
diff --git a/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/ipch/AutoPCH/399985e87082cbcc/MAIN.ipch b/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/ipch/AutoPCH/399985e87082cbcc/MAIN.ipch
new file mode 100644
index 00000000..408c8754
Binary files /dev/null and b/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/ipch/AutoPCH/399985e87082cbcc/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/ipch/AutoPCH/e3cc1ddad52798da/MAIN.ipch b/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/ipch/AutoPCH/e3cc1ddad52798da/MAIN.ipch
new file mode 100644
index 00000000..4079e0a2
Binary files /dev/null and b/FinishedTasks_HW/Task_3_HW/.vs/Task_3_HW/v16/ipch/AutoPCH/e3cc1ddad52798da/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_3_HW/Task_3_HW.sln b/FinishedTasks_HW/Task_3_HW/Task_3_HW.sln
new file mode 100644
index 00000000..9f9eba2f
--- /dev/null
+++ b/FinishedTasks_HW/Task_3_HW/Task_3_HW.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task_3_HW", "Task_3_HW\Task_3_HW.vcxproj", "{745DA0D1-A299-4427-BD4C-39BD822D6CE2}"
+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
+ {745DA0D1-A299-4427-BD4C-39BD822D6CE2}.Debug|x64.ActiveCfg = Debug|x64
+ {745DA0D1-A299-4427-BD4C-39BD822D6CE2}.Debug|x64.Build.0 = Debug|x64
+ {745DA0D1-A299-4427-BD4C-39BD822D6CE2}.Debug|x86.ActiveCfg = Debug|Win32
+ {745DA0D1-A299-4427-BD4C-39BD822D6CE2}.Debug|x86.Build.0 = Debug|Win32
+ {745DA0D1-A299-4427-BD4C-39BD822D6CE2}.Release|x64.ActiveCfg = Release|x64
+ {745DA0D1-A299-4427-BD4C-39BD822D6CE2}.Release|x64.Build.0 = Release|x64
+ {745DA0D1-A299-4427-BD4C-39BD822D6CE2}.Release|x86.ActiveCfg = Release|Win32
+ {745DA0D1-A299-4427-BD4C-39BD822D6CE2}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {139BD529-A957-417B-8E60-BB5F8D92C1E4}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_HW/Task_3_HW/Task_3_HW/Task_3_HW.vcxproj b/FinishedTasks_HW/Task_3_HW/Task_3_HW/Task_3_HW.vcxproj
new file mode 100644
index 00000000..0bcfce3b
--- /dev/null
+++ b/FinishedTasks_HW/Task_3_HW/Task_3_HW/Task_3_HW.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {745da0d1-a299-4427-bd4c-39bd822d6ce2}
+ Task3HW
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_HW/Task_3_HW/Task_3_HW/Task_3_HW.vcxproj.filters b/FinishedTasks_HW/Task_3_HW/Task_3_HW/Task_3_HW.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_HW/Task_3_HW/Task_3_HW/Task_3_HW.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/FinishedTasks_HW/Task_3_HW/Task_3_HW/Task_3_HW.vcxproj.user b/FinishedTasks_HW/Task_3_HW/Task_3_HW/Task_3_HW.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_HW/Task_3_HW/Task_3_HW/Task_3_HW.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_3_HW/Task_3_HW/main.c b/FinishedTasks_HW/Task_3_HW/Task_3_HW/main.c
new file mode 100644
index 00000000..12e830c4
--- /dev/null
+++ b/FinishedTasks_HW/Task_3_HW/Task_3_HW/main.c
@@ -0,0 +1,74 @@
+#include
+#include
+#include
+#include
+
+int main()
+{
+ char* locale = setlocale(LC_ALL, "");
+ int j, try_number, n, * computerNumber_massive;
+ int i = 0;
+
+ printf(" \" \"\n");
+ printf(" ( 2 5): \n");
+ scanf_s("%d", &n);
+
+ srand(time(0));
+ computerNumber_massive = malloc(n * sizeof(int));
+
+ while (i < n) {
+ if (i == 0) {
+ computerNumber_massive[i] = 1 + rand() % 9;
+ i++;
+ }
+ else
+ {
+ try_number = rand() % 9;
+ int ok = 1;
+ for (j = 0; ok && j != i; j++) {
+ ok &= (try_number != computerNumber_massive[j]);
+ }
+ if (ok) {
+ computerNumber_massive[i] = try_number;
+ i++;
+ }
+ }
+ }
+
+ int userNumber, numbers_OF_userNumber, * userNumber_massive;
+ while (1) {
+
+ printf("\n %d ( ): \n", n);
+ scanf_s("%d", &userNumber);
+
+ userNumber_massive = malloc(n * sizeof(int));
+ int k = n;
+ while (k > 0) {
+ numbers_OF_userNumber = userNumber % 10;
+ userNumber_massive[k - 1] = numbers_OF_userNumber;
+ userNumber = userNumber / 10;
+ k--;
+ }
+ int bull = 0;
+ int cow = 0;
+ for (int t1 = 0; t1 < n; t1++) {
+ for (int t2 = 0; t2 < n; t2++) {
+ if (userNumber_massive[t1] == computerNumber_massive[t2] && t1 == t2) {
+ bull++;
+ if (bull == n) {
+ printf(" , !!!\n");
+ return exit;
+ }
+ }
+ else if (userNumber_massive[t1] == computerNumber_massive[t2] && t1 != t2) {
+ cow++;
+ }
+ }
+ }
+ printf(" : %d\n : %d\n", cow, bull);
+ }
+
+ free(userNumber_massive);
+ free(computerNumber_massive);
+ return 0;
+}
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/.suo b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/.suo
new file mode 100644
index 00000000..650bb29e
Binary files /dev/null and b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/.suo differ
diff --git a/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/Browse.VC.db b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/Browse.VC.db
new file mode 100644
index 00000000..90523933
Binary files /dev/null and b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/Browse.VC.db differ
diff --git a/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/478ff0924a8a05c0/MAIN (1).ipch b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/478ff0924a8a05c0/MAIN (1).ipch
new file mode 100644
index 00000000..2d52750d
Binary files /dev/null and b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/478ff0924a8a05c0/MAIN (1).ipch differ
diff --git a/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/553d22cf3cc5a2cc/MAIN1.ipch b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/553d22cf3cc5a2cc/MAIN1.ipch
new file mode 100644
index 00000000..d13c9348
Binary files /dev/null and b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/553d22cf3cc5a2cc/MAIN1.ipch differ
diff --git a/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/77e095276d956f96/MAIN.ipch b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/77e095276d956f96/MAIN.ipch
new file mode 100644
index 00000000..cb3071c0
Binary files /dev/null and b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/77e095276d956f96/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/a34d1129b2762454/MAIN1.ipch b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/a34d1129b2762454/MAIN1.ipch
new file mode 100644
index 00000000..b2ae561b
Binary files /dev/null and b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/a34d1129b2762454/MAIN1.ipch differ
diff --git a/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/c2f92fcfd6c54693/MAIN.ipch b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/c2f92fcfd6c54693/MAIN.ipch
new file mode 100644
index 00000000..32bb6c87
Binary files /dev/null and b/FinishedTasks_HW/Task_4_HW/.vs/Task_4_HW/v16/ipch/AutoPCH/c2f92fcfd6c54693/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_4_HW/Task_4_HW.sln b/FinishedTasks_HW/Task_4_HW/Task_4_HW.sln
new file mode 100644
index 00000000..a9616c1d
--- /dev/null
+++ b/FinishedTasks_HW/Task_4_HW/Task_4_HW.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task_4_HW", "Task_4_HW\Task_4_HW.vcxproj", "{694F98E5-BC7E-419D-9948-F39E2C6D742E}"
+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
+ {694F98E5-BC7E-419D-9948-F39E2C6D742E}.Debug|x64.ActiveCfg = Debug|x64
+ {694F98E5-BC7E-419D-9948-F39E2C6D742E}.Debug|x64.Build.0 = Debug|x64
+ {694F98E5-BC7E-419D-9948-F39E2C6D742E}.Debug|x86.ActiveCfg = Debug|Win32
+ {694F98E5-BC7E-419D-9948-F39E2C6D742E}.Debug|x86.Build.0 = Debug|Win32
+ {694F98E5-BC7E-419D-9948-F39E2C6D742E}.Release|x64.ActiveCfg = Release|x64
+ {694F98E5-BC7E-419D-9948-F39E2C6D742E}.Release|x64.Build.0 = Release|x64
+ {694F98E5-BC7E-419D-9948-F39E2C6D742E}.Release|x86.ActiveCfg = Release|Win32
+ {694F98E5-BC7E-419D-9948-F39E2C6D742E}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {423AF373-1149-46B8-9FFD-DCCD1DAB6853}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_HW/Task_4_HW/Task_4_HW/Task_4_HW.vcxproj b/FinishedTasks_HW/Task_4_HW/Task_4_HW/Task_4_HW.vcxproj
new file mode 100644
index 00000000..e8d4c5bc
--- /dev/null
+++ b/FinishedTasks_HW/Task_4_HW/Task_4_HW/Task_4_HW.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {694f98e5-bc7e-419d-9948-f39e2c6d742e}
+ Task4HW
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_HW/Task_4_HW/Task_4_HW/Task_4_HW.vcxproj.filters b/FinishedTasks_HW/Task_4_HW/Task_4_HW/Task_4_HW.vcxproj.filters
new file mode 100644
index 00000000..ab982d02
--- /dev/null
+++ b/FinishedTasks_HW/Task_4_HW/Task_4_HW/Task_4_HW.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/FinishedTasks_HW/Task_4_HW/Task_4_HW/Task_4_HW.vcxproj.user b/FinishedTasks_HW/Task_4_HW/Task_4_HW/Task_4_HW.vcxproj.user
new file mode 100644
index 00000000..0f14913f
--- /dev/null
+++ b/FinishedTasks_HW/Task_4_HW/Task_4_HW/Task_4_HW.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_4_HW/Task_4_HW/main1.c b/FinishedTasks_HW/Task_4_HW/Task_4_HW/main1.c
new file mode 100644
index 00000000..f07485db
--- /dev/null
+++ b/FinishedTasks_HW/Task_4_HW/Task_4_HW/main1.c
@@ -0,0 +1,197 @@
+#include
+#include
+#include
+#include
+#include
+
+#define size 10
+
+char products[size][40] = { {"Samsung Galaxy S8+ 64GB"}, {"Xiaomi Mi8 6/64GB"}, {"ASUS ZenFone 5 ZE620KL 4/64GB"}, {"Xiaomi Redmi Note 5 4/64GB"}, {"Samsung Galaxy J8 (2018) 32GB"}, {"Huawei P20 Lite"}, {"Huawei P smart 32GB"}, {"Xiaomi Redmi 6 3/32GB"}, {"Xiaomi Redmi 6A 2/16GB"}, {"Xiaomi Redmi S2 3/32GB"} };
+int barcode[size][4];
+int price[size] = { 40000, 25000, 21000, 18000, 15999, 14500, 12300, 12450, 11550, 11111 };
+int discount[size];
+
+int generateRandNumber(int max, int min) { //
+ int value = min + rand() % (max - min + 1);
+ return value;
+}
+
+void printInformation_Barcode(int number) { //
+ printf(" : ");
+ for (int j = 0; j < 4; j++)
+ printf("%d", barcode[number][j]);
+ printf(" | : %s | ", products[number]);
+ printf(": %d | ", price[number]);
+ printf(": %d%% |\n", discount[number]);
+}
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+
+ int isTotalWork = 1;
+ int VariantOfProg;
+
+ for (int i = 0; i < size; i++) {
+ for (int j = 0; j < 4; j++) {
+ barcode[i][j] = generateRandNumber(9, 0);
+ }
+ }
+ for (int i = 0; i < size; i++)
+ discount[i] = generateRandNumber(50, 1);
+
+ while (isTotalWork) {
+ printf(" !\n\n");
+ printf(" (1)\n");
+ printf(" (2)\n");
+ printf(" (3)\n");
+ printf(" (4)\n");
+ printf(" (5)\n");
+ printf(" (0)\n");
+ printf("\n -1\n");
+
+ int isWork = 1;
+
+ int checkProducts_index[size];
+ int checkPrice[size];
+ int numberOfProducts[size];
+ int schetchik = 0;
+
+ while (isWork) {
+ printf("\n : ");
+ scanf_s("%d", &VariantOfProg);
+ printf("\n");
+
+ int scanOfBarcode[4];
+ int shtrix;
+ int isWorkScanOfBarcode = 1;
+
+ if (VariantOfProg == 0) return exit;
+
+ switch (VariantOfProg) {
+ case 1:
+ printf(" :\n");
+ for (int i = 0; i < size; i++) {
+ printInformation_Barcode(i);
+ }
+ break;
+ case 2:
+ printf(" : ");
+ scanf_s("%d", &shtrix);
+ int scanOfBarcode[4];
+ for (int i = 3; i >= 0; i--) {
+ scanOfBarcode[i] = shtrix % 10;
+ shtrix = shtrix / 10;
+ }
+ int flag_2 = 1;
+ for (int i = 0; i < size; i++) {
+ if (scanOfBarcode[0] == barcode[i][0] && scanOfBarcode[1] == barcode[i][1] && scanOfBarcode[2] == barcode[i][2] && scanOfBarcode[3] == barcode[i][3]) {
+ printInformation_Barcode(i);
+ flag_2 = 0;
+ break;
+ }
+ }
+ if (flag_2)
+ printf(" ! !\n");
+ break;
+ case 3:
+ while (isWorkScanOfBarcode) {
+ printf("\n ( -1): ");
+ scanf_s("%d", &shtrix);
+ if (shtrix == -1)
+ break;
+ for (int i = 3; i >= 0; i--) {
+ scanOfBarcode[i] = shtrix % 10;
+ shtrix = shtrix / 10;
+ }
+ int flag_3 = 1;
+ int ok_new = 1;
+ for (int i = 0; i < size; i++) {
+ if (scanOfBarcode[0] == barcode[i][0] && scanOfBarcode[1] == barcode[i][1] && scanOfBarcode[2] == barcode[i][2] && scanOfBarcode[3] == barcode[i][3]) {
+ for (int j = 0; j < size; j++) {
+ if (checkProducts_index[j] == i) {
+ numberOfProducts[j] += 1;
+ checkPrice[j] += price[i];
+ ok_new = 0;
+ break;
+ }
+ }
+ if (ok_new) {
+ checkProducts_index[schetchik] = i;
+ numberOfProducts[schetchik] = 1;
+ checkPrice[schetchik] = price[i];
+ schetchik += 1;
+ }
+ printf("\n !\n");
+ flag_3 = 0;
+ }
+ }
+ if (flag_3)
+ printf("\n ! !\n");
+ }
+ break;
+ case 4:
+ printf(" :\n\n");
+ int flag_4 = 1;
+ int notTotalPrice = 0;
+ int totalDiscount;
+ float totalPrice = 0;
+ for (int i = 0; i < size; i++) {
+ for (int j = 0; j < size; j++){
+ if (checkProducts_index[i] == j) {
+ printf(": %s | ", products[j]);
+ printf(": %d | ", numberOfProducts[i]);
+ printf(" : %d | ", checkPrice[i]);
+ printf(": %d%%\n", discount[j]);
+ totalPrice += checkPrice[i] - ((checkPrice[i] * discount[j]) / 100);
+ notTotalPrice += checkPrice[i];
+ flag_4 = 0;
+ }
+ }
+ }
+ if (!flag_4) {
+ totalDiscount = 100 - ((totalPrice / notTotalPrice) * 100);
+ printf("\n : %d \n", notTotalPrice);
+ printf(" : %.2f \n", totalPrice);
+ printf(" : %d%%\n", totalDiscount);
+ }
+ if (flag_4)
+ printf(" !\n");
+ break;
+ case 5:
+ printf(" :\n\n");
+ int flag_5 = 1;
+ int last_notTotalPrice = 0;
+ int last_totalDiscount;
+ float last_totalPrice = 0;
+ for (int i = 0; i < size; i++) {
+ for (int j = 0; j < size; j++) {
+ if (checkProducts_index[i] == j) {
+ printf(": %s | ", products[j]);
+ printf(": %d | ", numberOfProducts[i]);
+ printf(" : %d | ", checkPrice[i]);
+ printf(": %d%%\n", discount[j]);
+ last_totalPrice += checkPrice[i] - ((checkPrice[i] * discount[j]) / 100);
+ last_notTotalPrice += checkPrice[i];
+ flag_5 = 0;
+ }
+ }
+ }
+ if (!flag_5) {
+ last_totalDiscount = 100 - ((last_totalPrice / last_notTotalPrice) * 100);
+ printf("\n : %d \n", last_notTotalPrice);
+ printf(" : %.2f \n", last_totalPrice);
+ printf(" : %d%%\n", last_totalDiscount);
+ }
+ if (flag_5)
+ printf(" !\n");
+ printf("\n , !\n");
+ return exit;
+ case -1:
+ isWork = 0;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/.suo b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/.suo
new file mode 100644
index 00000000..2517b32c
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/.suo differ
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/Browse.VC.db b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/Browse.VC.db
new file mode 100644
index 00000000..39c7e08f
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/Browse.VC.db differ
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/1503d6e622c4a4ff/MAIN.ipch b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/1503d6e622c4a4ff/MAIN.ipch
new file mode 100644
index 00000000..1a463c63
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/1503d6e622c4a4ff/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/9a4be458e85a8a13/MAIN.ipch b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/9a4be458e85a8a13/MAIN.ipch
new file mode 100644
index 00000000..da36bc74
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/9a4be458e85a8a13/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/b65120f3c08c5078/MAIN.ipch b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/b65120f3c08c5078/MAIN.ipch
new file mode 100644
index 00000000..e1b7c5d6
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/b65120f3c08c5078/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/db0fca10a5cbc44e/MAIN.ipch b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/db0fca10a5cbc44e/MAIN.ipch
new file mode 100644
index 00000000..fb886b20
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/db0fca10a5cbc44e/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/e9c56a5812bbecc6/MAIN.ipch b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/e9c56a5812bbecc6/MAIN.ipch
new file mode 100644
index 00000000..874b8b27
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_FileManager/.vs/Task_5_HW_FileManager/v16/ipch/AutoPCH/e9c56a5812bbecc6/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager.sln b/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager.sln
new file mode 100644
index 00000000..ce163200
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task_5_HW_FileManager", "Task_5_HW_FileManager\Task_5_HW_FileManager.vcxproj", "{619D3C63-BC04-44A4-9BB8-6BCE0C9BFD57}"
+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
+ {619D3C63-BC04-44A4-9BB8-6BCE0C9BFD57}.Debug|x64.ActiveCfg = Debug|x64
+ {619D3C63-BC04-44A4-9BB8-6BCE0C9BFD57}.Debug|x64.Build.0 = Debug|x64
+ {619D3C63-BC04-44A4-9BB8-6BCE0C9BFD57}.Debug|x86.ActiveCfg = Debug|Win32
+ {619D3C63-BC04-44A4-9BB8-6BCE0C9BFD57}.Debug|x86.Build.0 = Debug|Win32
+ {619D3C63-BC04-44A4-9BB8-6BCE0C9BFD57}.Release|x64.ActiveCfg = Release|x64
+ {619D3C63-BC04-44A4-9BB8-6BCE0C9BFD57}.Release|x64.Build.0 = Release|x64
+ {619D3C63-BC04-44A4-9BB8-6BCE0C9BFD57}.Release|x86.ActiveCfg = Release|Win32
+ {619D3C63-BC04-44A4-9BB8-6BCE0C9BFD57}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {7666D088-2F63-4630-B3F1-E2B163F66304}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/Task_5_HW_FileManager.vcxproj b/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/Task_5_HW_FileManager.vcxproj
new file mode 100644
index 00000000..86a0ee2c
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/Task_5_HW_FileManager.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {619d3c63-bc04-44a4-9bb8-6bce0c9bfd57}
+ Task5HWFileManager
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/Task_5_HW_FileManager.vcxproj.filters b/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/Task_5_HW_FileManager.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/Task_5_HW_FileManager.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/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/Task_5_HW_FileManager.vcxproj.user b/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/Task_5_HW_FileManager.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/Task_5_HW_FileManager.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/main.c b/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/main.c
new file mode 100644
index 00000000..62e1cf35
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/Task_5_HW_FileManager/main.c
@@ -0,0 +1,238 @@
+#define _CRT_SECURE_NO_WARNINGS
+
+#include
+#include
+#include
+#include
+#include "C:\Users\mrhin\Desktop\\ \Informatics-and-Programming\FinishedTasks_HW\Task_5_HW_FileManager\dirent-master\include\dirent.h" //
+#include
+
+char filesName[255][255];
+int filesSize[255];
+int arrayCount = 0;
+
+
+
+int getFileSize(const char* file) {
+ struct stat st;
+ int full_size = 0;
+
+ if (stat(file, &st) == 0) {
+ if ((st.st_mode & S_IFMT) == S_IFDIR)
+ return -1;
+ else if ((st.st_mode & S_IFMT) == S_IFREG)
+ return st.st_size;
+ else
+ return -2;
+ }
+}
+
+void getSizesFromDir(char* path) {
+ struct dirent* cur_file;
+ DIR* dir;
+
+ char full_file_path[200];
+
+ dir = opendir(path);
+
+ if (dir) {
+ while ((cur_file = readdir(dir)) != NULL) {
+ if (strcmp(".", cur_file->d_name) && strcmp("..", cur_file->d_name)) {
+ strcpy(full_file_path, strcat(strcat(strcpy(full_file_path, path), "/"), cur_file->d_name));
+ int cur_file_size = getFileSize(full_file_path);
+ if (cur_file_size >= 0) {
+ printf("%s - %d B (%d kB)\n", cur_file->d_name, cur_file_size, cur_file_size / 1024);
+
+ filesSize[arrayCount] = cur_file_size;
+ strncpy(filesName[arrayCount], cur_file->d_name, 254);
+ filesName[arrayCount][254] = '\0';
+ arrayCount++;
+
+ }
+ else if (cur_file_size == -1)
+ getSizesFromDir(full_file_path);
+ }
+ }
+ closedir(dir);
+ }
+}
+
+
+
+void sortInsert(int* array, int* indexes, int size) {
+ int temparray, tempindex;
+ for (int i = 1; i < size; i++)
+ for (int j = i; j > 0 && array[j - 1] > array[j]; j--) {
+ temparray = array[j - 1];
+ array[j - 1] = array[j];
+ array[j] = temparray;
+
+ tempindex = indexes[j - 1];
+ indexes[j - 1] = indexes[j];
+ indexes[j] = tempindex;
+ }
+}
+
+void sortHoare(int* array, int* indexes, int first, int last) {
+ int i = first, j = last, x = array[(first + last) / 2];
+
+ do {
+ while (array[i] < x) i++;
+ while (array[j] > x) j--;
+ if (i <= j) {
+ if (array[i] > array[j]) {
+ int tmparray = array[j];
+ array[j] = array[i];
+ array[i] = tmparray;
+
+ int tmpindex = indexes[j];
+ indexes[j] = indexes[i];
+ indexes[i] = tmpindex;
+ }
+ i++;
+ j--;
+ }
+
+ } while (i <= j);
+
+ if (i < last) sortHoare(array, indexes, i, last);
+ if (j > first) sortHoare(array, indexes, first, j);
+
+}
+
+void shiftDown(int* array, int* indexes, int root, int bottom) { //
+ int maxChildArray, maxChildIndex;
+ int done = 0;
+ while ((root * 2 <= bottom) && (!done)) {
+ if (root * 2 == bottom) {
+ maxChildArray = root * 2;
+ maxChildIndex = root * 2;
+ }
+ else if (array[root * 2] > array[root * 2 + 1]) {
+ maxChildArray = root * 2;
+ maxChildIndex = root * 2;
+ }
+ else {
+ maxChildArray = root * 2 + 1;
+ maxChildIndex = root * 2 + 1;
+ }
+ if (array[root] < array[maxChildArray]) {
+ int tempArray = array[root];
+ array[root] = array[maxChildArray];
+ array[maxChildArray] = tempArray;
+ root = maxChildArray;
+
+ int tempIndex = indexes[root];
+ indexes[root] = indexes[maxChildIndex];
+ indexes[maxChildIndex] = tempIndex;
+ root = maxChildIndex;
+ }
+ else
+ done = 1;
+ }
+}
+void sortHeap(int* array, int* indexes, int size) {
+ for (int i = (size / 2); i >= 0; i--)
+ shiftDown(array, indexes, i, size - 1);
+ for (int i = size - 1; i >= 1; i--) {
+ int temparray = array[0];
+ array[0] = array[i];
+ array[i] = temparray;
+
+ int tempindex = indexes[0];
+ indexes[0] = indexes[i];
+ indexes[i] = tempindex;
+ shiftDown(array, indexes, 0, i - 1);
+ }
+}
+
+
+void inputIndexArray(int* array, int size) {
+ for (int j = 0; j < size; j++) {
+ array[j] = j;
+ }
+}
+
+void copyArray(int* array_1, int* array_2, int size) {
+ for (int j = 0; j < size; j++) {
+ array_1[j] = array_2[j];
+ }
+}
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+ char path[200];
+ float time;
+ int progVar = 0;
+ int isWork = 1;
+
+ printf(" : ");
+ gets(path);
+
+ printf("\n");
+ getSizesFromDir(path);
+ printf("\n : %d", arrayCount);
+
+ int* allArrayIndex_1 = malloc(sizeof(int) * arrayCount);
+ inputIndexArray(allArrayIndex_1, arrayCount);
+ int* arrayCopy_1 = malloc(sizeof(int) * arrayCount);
+ copyArray(arrayCopy_1, filesSize, arrayCount);
+
+ int* allArrayIndex_2 = malloc(sizeof(int) * arrayCount);
+ inputIndexArray(allArrayIndex_2, arrayCount);
+ int* arrayCopy_2 = malloc(sizeof(int) * arrayCount);
+ copyArray(arrayCopy_2, filesSize, arrayCount);
+
+ int* allArrayIndex_3 = malloc(sizeof(int) * arrayCount);
+ inputIndexArray(allArrayIndex_3, arrayCount);
+ int* arrayCopy_3 = malloc(sizeof(int) * arrayCount);
+ copyArray(arrayCopy_3, filesSize, arrayCount);
+
+ while (isWork) {
+ printf("\n\n : \n");
+ printf("(1) \n");
+ printf("(2) \n");
+ printf("(3) \n");
+ printf("(0) \n\n");
+ scanf_s("%d", &progVar);
+
+ switch (progVar) {
+ case 1:
+ time = clock();
+ sortInsert(arrayCopy_1, allArrayIndex_1, arrayCount);
+ time = clock() - time;
+ for (int j = 0; j < arrayCount; j++) {
+ int k = allArrayIndex_1[j];
+ printf("%s - %d B (%d kB)\n", filesName[k], arrayCopy_1[j], arrayCopy_1[j] / 100);
+ }
+ printf("\n : %.2fs", time / 1000);
+ break;
+ case 2:
+ time = clock();
+ sortHoare(arrayCopy_2, allArrayIndex_2, 0, arrayCount - 1);
+ time = clock() - time;
+ for (int j = 0; j < arrayCount; j++) {
+ int k = allArrayIndex_2[j];
+ printf("%s - %d B (%d kB)\n", filesName[k], arrayCopy_2[j], arrayCopy_2[j] / 100);
+ }
+ printf("\n : %.2fs", time / 1000);
+ break;
+ case 3:
+ time = clock();
+ sortHeap(arrayCopy_3, allArrayIndex_3, arrayCount);
+ time = clock() - time;
+ for (int j = 0; j < arrayCount; j++) {
+ int k = allArrayIndex_3[j];
+ printf("%s - %d B (%d kB)\n", filesName[k], arrayCopy_3[j], arrayCopy_3[j] / 100);
+ }
+ printf("\n : %.2fs", time / 1000);
+ break;
+ case 0:
+ isWork = 0;
+ break;
+ default:
+ break;
+ }
+ }
+ return 0;
+}
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/.gitignore b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/.gitignore
new file mode 100644
index 00000000..1e9efe31
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/.gitignore
@@ -0,0 +1,24 @@
+/CMakeCache.txt
+/CMakeFiles
+/CTestTestfile.cmake
+/DartConfiguration.tcl
+/Makefile
+/Testing
+/Win32
+/cmake_install.cmake
+/find
+/locate
+/ls
+/scandir
+/cat
+/t-compile
+/t-dirent
+/t-scandir
+/t-cplusplus
+/t-unicode
+/t-strverscmp
+/t-utf8
+/updatedb
+/*.filters
+/*.vcxproj
+/*.dir
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/CMakeLists.txt b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/CMakeLists.txt
new file mode 100644
index 00000000..a607adf3
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/CMakeLists.txt
@@ -0,0 +1,62 @@
+cmake_minimum_required (VERSION 2.8.12)
+project (dirent LANGUAGES C CXX)
+
+# User options
+option(DIRENT_BUILD_TESTS "Build bundled tests" ON)
+message(STATUS "Build test and example programs: ${DIRENT_BUILD_TESTS}")
+
+# Initialize C and C++ compilers
+enable_language (C CXX)
+
+# Compile in debug mode by default
+if (NOT CMAKE_BUILD_TYPE)
+ set (CMAKE_BUILD_TYPE Debug
+ CACHE STRING
+ "Type of build: None Debug Release RelWithDebInfo MinSizeRel."
+ FORCE
+ )
+endif (NOT CMAKE_BUILD_TYPE)
+
+# Use the include directory only on Windows
+if (WIN32)
+ include_directories (${CMAKE_SOURCE_DIR}/include)
+endif (WIN32)
+
+# Install dirent.h
+if (WIN32)
+ install (FILES include/dirent.h DESTINATION include)
+endif (WIN32)
+
+# Add distclean target
+add_custom_target (distclean
+ COMMAND ${CMAKE_BUILD_TOOL} clean
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/distclean.cmake
+)
+
+# Build example programs
+if(DIRENT_BUILD_TESTS)
+ add_executable (find examples/find.c)
+ add_executable (ls examples/ls.c)
+ add_executable (locate examples/locate.c)
+ add_executable (updatedb examples/updatedb.c)
+ add_executable (scandir examples/scandir.c)
+ add_executable (cat examples/cat.c)
+ add_executable (dirls examples/dirls.c)
+
+ # Build test programs
+ include (CTest)
+ add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C ${CMAKE_CFG_INTDIR})
+ function (add_test_executable TEST_NAME)
+ add_executable (${TEST_NAME} EXCLUDE_FROM_ALL ${ARGN})
+ add_test (NAME ${TEST_NAME} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND $)
+ add_dependencies (check ${TEST_NAME})
+ endfunction (add_test_executable)
+
+ add_test_executable (t-compile tests/t-compile.c)
+ add_test_executable (t-dirent tests/t-dirent.c)
+ add_test_executable (t-scandir tests/t-scandir.c)
+ add_test_executable (t-unicode tests/t-unicode.c)
+ add_test_executable (t-cplusplus tests/t-cplusplus.cpp)
+ add_test_executable (t-strverscmp tests/t-strverscmp.c)
+ add_test_executable (t-utf8 tests/t-utf8.c)
+endif(DIRENT_BUILD_TESTS)
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/CONTRIBUTING.md b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/CONTRIBUTING.md
new file mode 100644
index 00000000..bff76c3e
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/CONTRIBUTING.md
@@ -0,0 +1,41 @@
+# Contributing to Dirent
+
+Dirent is an open source project and we love to receive contributions from our
+community -- you! There are many ways to contribute, from writing tutorials
+or blog posts, improving the documentation, submitting bug reports and
+feature requests, or writing code which can be incorporated into Dirent.
+
+For example, we are looking for contributions which
+
+1. Improve portability of code developed for Unix/Linux to Microsoft Windows.
+2. Make Dirent easier to use and/or more useful for programmers working on
+ Microsoft Windows platform.
+3. Remove compiler warnings or fix bugs.
+
+## How to Suggest a Feature
+
+We use Github to host code, to track issues and to discuss about Dirent. If
+you would like to suggest a feature, then open an issue at Github.
+
+## How to Report a Bug
+
+If you have trouble using Dirent, then try to repeat the problem with the
+latest version found at Github. If the problem remains, then open an issue
+at Github.
+
+## How to Submit a Fix or an Enhancement
+
+If you wish to contribute code, then fork the repo and test the change in your
+private repo first. If the change works for you and you would like to donate
+the change back to the community, then make a pull request at Github.
+
+Before making a pull request, please consider that:
+
+1. We can only accept contributions which are compatible with [MIT Software
+ License](LICENSE).
+2. By making a pull request, you agree to transfer all copyrights to us.
+3. Our code will be reviewed and edited by us. In particular, we may
+ reformat your code according to the [Linux Kernel Coding
+ Style](https://www.kernel.org/doc/html/v4.10/process/coding-style.html)
+
+
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/ChangeLog b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/ChangeLog
new file mode 100644
index 00000000..d79cea25
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/ChangeLog
@@ -0,0 +1,129 @@
+2018-05-08 Toni Rönkkö
+
+ * Version 1.23.2: fixes bad scandir prototype.
+
+2017-08-27 Toni Rönkkö
+
+ * Version 1.23: support readdir_r and scandir functions.
+
+2017-07-18 Toni Rönkkö
+
+ * Created release branches v1.22 and v1.21 to Git. Published version
+ 1.22 at softagalleria.net.
+
+2016-09-11 Toni Rönkkö
+
+ * Version 1.22: added support for CMake. Thanks to Paul Fultz II.
+
+2014-09-25 Toni Rönkkö
+
+ * Version 1.21: compiles correctly under Open Watcom. Thanks to
+ Virgil Banowetz for a patch!
+
+2014-04-07 Toni Rönkkö
+
+ * Version 1.20.1: the zip file from the previous version did not open
+ correctly with Microsoft's compressed folders. Thanks to Alexandre
+ for info!
+
+2014-03-17 Toni Ronkko
+
+ * Version 1.20: dirent.h compiles correctly in 64-bit architecture.
+ Thanks to Aaron Simmons!
+
+2014-03-03 Toni Ronkko
+
+ * Version 1.13.2: define DT_LNK for compatibility with Unix
+ programs. Thanks to Joel Bruick for suggestion!
+
+2013-01-27 Toni Ronkko
+
+ * Version 1.13.1: patch from Edward Berner fixes set_errno() on
+ Windows NT 4.0.
+
+ * Revised wcstombs() and mbstowcs() wrappers to make sure that they do
+ not write past their target string.
+
+ * PATH_MAX from windows.h includes zero terminator so there is no
+ need to add one extra byte to variables and structures.
+
+2012-12-12 Toni Ronkko
+
+ * Version 1.13: use the traditional 8+3 file naming scheme if a file
+ name cannot be represented in the default ANSI code page. Now
+ compiles again with MSVC 6.0. Thanks to Konstantin Khomoutov for
+ testing.
+
+2012-10-01 Toni Ronkko
+
+ * Version 1.12.1: renamed wide-character DIR structure _wDIR to
+ _WDIR (with capital W) in order to maintain compatibility with MingW.
+
+2012-09-30 Toni Ronkko
+
+ * Version 1.12: define PATH_MAX and NAME_MAX. Added wide-character
+ variants _wDIR, _wdirent, _wopendir(), _wreaddir(), _wclosedir() and
+ _wrewinddir(). Thanks to Edgar Buerkle and Jan Nijtmans for ideas
+ and code.
+
+ * Now avoiding windows.h. This allows dirent.h to be integrated
+ more easily into programs using winsock. Thanks to Fernando
+ Azaldegui.
+
+2011-03-15 Toni Ronkko
+
+ * Version 1.11: defined FILE_ATTRIBUTE_DEVICE for MSVC 6.0.
+
+2010-08-11 Toni Ronkko
+
+ * Version 1.10: added d_type and d_namlen fields to dirent structure.
+ The former is especially useful for determining whether directory
+ entry represents a file or a directory. For more information, see
+ http://www.delorie.com/gnu/docs/glibc/libc_270.html
+
+ * Improved conformance to the standards. For example, errno is now
+ set properly on failure and assert() is never used. Thanks to Peter
+ Brockam for suggestions.
+
+ * Fixed a bug in rewinddir(): when using relative directory names,
+ change of working directory no longer causes rewinddir() to fail.
+
+2009-12-15 John Cunningham
+
+ * Version 1.9: added rewinddir member function
+
+2008-01-18 Toni Ronkko
+
+ * Version 1.8: Using FindFirstFileA and WIN32_FIND_DATAA to avoid
+ converting string between multi-byte and unicode representations.
+ This makes the code simpler and also allows the code to be compiled
+ under MingW. Thanks to Azriel Fasten for the suggestion.
+
+2007-03-04 Toni Ronkko
+
+ * Bug fix: due to the strncpy_s() function this file only compiled in
+ Visual Studio 2005. Using the new string functions only when the
+ compiler version allows.
+
+2006-11-02 Toni Ronkko
+
+ * Major update: removed support for Watcom C, MS-DOS and Turbo C to
+ simplify the file, updated the code to compile cleanly on Visual
+ Studio 2005 with both unicode and multi-byte character strings,
+ removed rewinddir() as it had a bug.
+
+2006-08-20 Toni Ronkko
+
+ * Removed all remarks about MSVC 1.0, which is antiqued now.
+ Simplified comments by removing SGML tags.
+
+2002-05-14 Toni Ronkko
+
+ * Embedded the function definitions directly to the header so that no
+ source modules need to be included in the Visual Studio project.
+ Removed all the dependencies to other projects so that this header
+ file can be used independently.
+
+1998-05-28 Toni Ronkko
+
+ * First version.
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/LICENSE b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/LICENSE
new file mode 100644
index 00000000..af043606
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 1998-2019 Toni Ronkko
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/README.md b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/README.md
new file mode 100644
index 00000000..bd31abca
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/README.md
@@ -0,0 +1,135 @@
+# Dirent
+
+Dirent is a C/C++ programming interface that allows programmers to retrieve
+information about files and directories under Linux/UNIX. This project
+provides Linux compatible Dirent interface for Microsoft Windows.
+
+
+# How to Enable UTF-8 Support
+
+By default, Dirent functions expect the directory names to be represented in
+the currently selected windows codepage. Moverover, Dirent functions return
+file names in the presently selected codepage. If you wish to use UTF-8 file
+names instead, then set the program's locale to ".utf8" or similar. For
+example, your C main program might look like-
+
+```
+#include
+
+int main(int argc, char *argv[])
+{
+ setlocale(LC_ALL, "LC_CTYPE=.utf8");
+
+ /*...*/
+}
+```
+
+For more information on UTF-8 support, please see setlocale in Visual Studio
+[C runtime library reference](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale?view=msvc-160#utf-8-support).
+
+
+# Installation
+
+Download the latest Dirent installation package from
+[GitHub](https://github.com/tronkko/dirent/releases) and
+unpack the installation file with 7-zip, for example. The installation
+package contains ``include/dirent.h`` file as well as a few example and test
+programs.
+
+
+## Installing Dirent for All Programs
+
+To make dirent.h available for all C/C++ programs, simply copy the
+``include/dirent.h`` file to the system include directory. System include
+directory contains header files such as ``assert.h`` and ``windows.h``. In
+Visual Studio 2008, for example, the system include may be found at
+``C:\Program Files\Microsoft Visual Studio 9.0\VC\include``.
+
+Everything you need is included in the single ``dirent.h`` file, and you can
+start using Dirent immediately -- there is no need to add files to your
+Visual Studio project.
+
+
+## Embedding Dirent into Your Own Project
+
+If you wish to distribute ``dirent.h`` alongside with your own source code,
+then copy ``include/dirent.h`` file to a new sub-directory within your project
+and add that directory to include path on Windows while omitting the directory
+under Linux/UNIX. This allows your project to be compiled against native
+``dirent.h`` on Linux/UNIX while substituting the functionality on Microsoft
+Windows.
+
+
+## Examples
+
+The installation package contains six example programs:
+
+Program | Purpose
+-------- | -----------------------------------------------------------------
+ls | List files in a directory, e.g. ls "c:\Program Files"
+find | Find files in subdirectories, e.g. find "c:\Program Files\CMake"
+updatedb | Build database of files in a drive, e.g. updatedb c:\
+locate | Locate a file from database, e.g. locate notepad
+scandir | Demonstrate scandir() function
+cat | Print a text file to screen
+
+Please install [CMake](https://cmake.org/) to build example and test programs.
+Then, open command prompt and create a temporary directory ``c:\temp\dirent``
+for the build files as
+
+```
+c:\
+mkdir temp
+mkdir temp\dirent
+cd temp\dirent
+```
+
+Generate build files as
+
+```
+cmake d:\dirent
+```
+
+where ``d:\dirent`` is the root directory of the Dirent package (containing
+this README.md file). If wish to omit example programs from the
+build, then append the option ``-DDIRENT_BUILD_TESTS=OFF`` to the CMake
+command line.
+
+Once CMake is finished, open Visual Studio, load the generated ``dirent.sln``
+file from the build directory and build the whole solution. Once the build
+completes, run the example programs ls, find, updatedb and locate from the
+command prompt as
+
+```
+cd Debug
+ls .
+find .
+updatedb c:\
+locate cmd.exe
+```
+
+Visual Studio project also contains a solution named ``check`` which can be
+used to verify that Dirent works as expected. Just build the solution from
+Visual Studio to run the test programs.
+
+
+# Contributing
+
+We love to receive contributions from you. See the
+[CONTRIBUTING](CONTRIBUTING.md) file for details.
+
+
+# Copying
+
+Dirent may be freely distributed under the MIT license. See the
+[LICENSE](LICENSE) file for details.
+
+
+# Alternatives to Dirent
+
+I ported Dirent to Microsoft Windows in 1998 when only a few alternatives
+were available. However, the situation has changed since then and nowadays
+both [Cygwin](http://www.cygwin.com) and [MingW](http://www.mingw.org)
+allow you to compile a great number of UNIX programs in Microsoft Windows.
+They both provide a full dirent API as well as many other UNIX APIs. MingW
+can even be used for commercial applications!
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/distclean.cmake b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/distclean.cmake
new file mode 100644
index 00000000..60e69adc
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/distclean.cmake
@@ -0,0 +1,62 @@
+# Remove CMake generated temporary files
+set (cmake_generated
+ ${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj
+ ${CMAKE_BINARY_DIR}/ALL_BUILD.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/CMakeCache.txt
+ ${CMAKE_BINARY_DIR}/CMakeFiles
+ ${CMAKE_BINARY_DIR}/CTestTestfile.cmake
+ ${CMAKE_BINARY_DIR}/Continuous.vcxproj
+ ${CMAKE_BINARY_DIR}/Continuous.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/DartConfiguration.tcl
+ ${CMAKE_BINARY_DIR}/Debug
+ ${CMAKE_BINARY_DIR}/Experimental.vcxproj
+ ${CMAKE_BINARY_DIR}/Experimental.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/INSTALL.vcxproj
+ ${CMAKE_BINARY_DIR}/INSTALL.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/Makefile
+ ${CMAKE_BINARY_DIR}/Nightly.vcxproj
+ ${CMAKE_BINARY_DIR}/Nightly.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/NightlyMemoryCheck.vcxproj
+ ${CMAKE_BINARY_DIR}/NightlyMemoryCheck.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/RUN_TESTS.vcxproj
+ ${CMAKE_BINARY_DIR}/RUN_TESTS.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/Testing
+ ${CMAKE_BINARY_DIR}/Win32
+ ${CMAKE_BINARY_DIR}/ZERO_CHECK.vcxproj
+ ${CMAKE_BINARY_DIR}/ZERO_CHECK.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/check.vcxproj
+ ${CMAKE_BINARY_DIR}/check.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/cmake_install.cmake
+ ${CMAKE_BINARY_DIR}/dirent.sln
+ ${CMAKE_BINARY_DIR}/distclean.vcxproj
+ ${CMAKE_BINARY_DIR}/distclean.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/find
+ ${CMAKE_BINARY_DIR}/find.dir
+ ${CMAKE_BINARY_DIR}/find.vcxproj
+ ${CMAKE_BINARY_DIR}/find.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/locate
+ ${CMAKE_BINARY_DIR}/locate.dir
+ ${CMAKE_BINARY_DIR}/locate.vcxproj
+ ${CMAKE_BINARY_DIR}/locate.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/ls
+ ${CMAKE_BINARY_DIR}/ls.dir
+ ${CMAKE_BINARY_DIR}/ls.vcxproj
+ ${CMAKE_BINARY_DIR}/ls.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/t-compile
+ ${CMAKE_BINARY_DIR}/t-compile.dir
+ ${CMAKE_BINARY_DIR}/t-compile.vcxproj
+ ${CMAKE_BINARY_DIR}/t-compile.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/t-dirent
+ ${CMAKE_BINARY_DIR}/t-dirent.dir
+ ${CMAKE_BINARY_DIR}/t-dirent.vcxproj
+ ${CMAKE_BINARY_DIR}/t-dirent.vcxproj.filters
+ ${CMAKE_BINARY_DIR}/updatedb
+ ${CMAKE_BINARY_DIR}/updatedb.dir
+ ${CMAKE_BINARY_DIR}/updatedb.vcxproj
+ ${CMAKE_BINARY_DIR}/updatedb.vcxproj.filters
+)
+foreach (file ${cmake_generated})
+ if (EXISTS ${file})
+ file (REMOVE_RECURSE ${file})
+ endif()
+endforeach (file)
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/cat.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/cat.c
new file mode 100644
index 00000000..07f37312
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/cat.c
@@ -0,0 +1,73 @@
+/*
+ * Output contents of a file.
+ *
+ * Compile this file with Visual Studio and run the produced command in
+ * console with a file name argument. For example, command
+ *
+ * cat include\dirent.h
+ *
+ * will output the dirent.h to screen.
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#define _CRT_SECURE_NO_WARNINGS
+#include
+#include
+#include
+#include
+#include
+#include
+
+static void output_file(const char *fn);
+
+
+int main(int argc, char *argv[])
+{
+ /* Select default locale */
+ setlocale(LC_ALL, "");
+
+ /* Require at least one file */
+ if (argc == 1) {
+ fprintf(stderr, "Usage: cat filename\n");
+ return EXIT_FAILURE;
+ }
+
+ /* For each file name argument in command line */
+ int i = 1;
+ while (i < argc) {
+ output_file(argv[i]);
+ i++;
+ }
+ return EXIT_SUCCESS;
+}
+
+/*
+ * Output file to screen
+ */
+static void output_file(const char *fn)
+{
+ /* Open file */
+ FILE *fp = fopen(fn, "r");
+ if (!fp) {
+ /* Could not open directory */
+ fprintf(stderr, "Cannot open %s (%s)\n", fn, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ /* Output file to screen */
+ size_t n;
+ do {
+ /* Read some bytes from file */
+ char buffer[4096];
+ n = fread(buffer, 1, 4096, fp);
+
+ /* Output bytes to screen */
+ fwrite(buffer, 1, n, stdout);
+ } while (n != 0);
+
+ /* Close file */
+ fclose(fp);
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/dirls.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/dirls.c
new file mode 100644
index 00000000..20302f48
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/dirls.c
@@ -0,0 +1,192 @@
+/*
+ * An example demonstrating basic file information listing.
+ *
+ * Compile this file with Visual Studio and run the produced command in
+ * console with a directory name argument. For example, command
+ *
+ * dirls "C:\Users\User 1\Documents"
+ *
+ * might output something like
+ *
+ * ./
+ * ../
+ * budget.xlsx 19180
+ * directory_1/
+ * directory_2/
+ * notes.txt 320
+ * to_do_list.txt 245
+ *
+ * The dirls command provided by this file is only an example: the command
+ * does not have any fancy options.
+ *
+ * Copyright (C) 2006-2012 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define ERR_MSG_LEN 256
+
+static void list_directory(const char* dirname);
+static void list_size(const char* full_path);
+static void print_error_msg(const char* dirname, char* msg_buffer);
+static void get_full_path(const char* dirname, const char* filename, char* buffer);
+
+
+int main(int argc, char* argv[])
+{
+ /* Select default locale */
+ setlocale(LC_ALL, "");
+
+ /* For each directory in command line. */
+ int i = 1;
+ while (i < argc) {
+ list_directory(argv[i]);
+ i++;
+ printf("\n");
+ }
+
+ /* List current working directory if no arguments on command line */
+ if (argc == 1)
+ list_directory(".");
+
+ return EXIT_SUCCESS;
+}
+
+/*
+ * List files and file sizes in directory.
+ */
+static void list_directory(const char* dirname)
+{
+ /* Open directory stream */
+ DIR* dir = opendir(dirname);
+ if (!dir) {
+ /* Could not open directory; print error message */
+ char msg_buff[ERR_MSG_LEN];
+
+ /* Function replaces strerror with strerror_s */
+ print_error_msg(dirname, msg_buff);
+
+ exit(EXIT_FAILURE);
+ }
+
+ struct dirent* ent;
+ /* Print all files, file sizes, and directories within the directory */
+ while ((ent = readdir(dir)) != NULL) {
+ char buffer[PATH_MAX + 2];
+
+ switch (ent->d_type) {
+ case DT_REG:
+ printf("%s ", ent->d_name);
+ /* Get full file path */
+ get_full_path(dirname, ent->d_name, buffer);
+ /* Print file size next to file name */
+ list_size(buffer);
+ break;
+
+ case DT_DIR:
+ printf("%s/\n", ent->d_name);
+ break;
+
+ case DT_LNK:
+ printf("%s@ ", ent->d_name);
+ /* Get full file path */
+ get_full_path(dirname, ent->d_name, buffer);
+ /* Print file size next to file name */
+ list_size(buffer);
+ break;
+
+ default:
+ printf("%s* ", ent->d_name);
+ /* Get full file path */
+ get_full_path(dirname, ent->d_name, buffer);
+ /* Print file size next to file name */
+ list_size(buffer);
+ break;
+ }
+ }
+
+ closedir(dir);
+}
+
+/*
+ * Print file size next to file name.
+ */
+static void list_size(const char* full_path)
+{
+ struct stat stbuf;
+
+ if (stat(full_path, &stbuf) == -1)
+ printf("%s %s\n", "Can't access", full_path);
+ else
+ printf("%d\n", stbuf.st_size);
+}
+
+/*
+ * Enforce error message size limit and ensure valid error number.
+ * Print error message.
+ */
+static void print_error_msg(const char* dirname, char* msg_buff)
+{
+ int error_num;
+ error_num = strerror_s(msg_buff, ERR_MSG_LEN, errno);
+
+ switch (error_num) {
+ case 0:
+ printf("Cannot open %s (%s)\n", dirname, msg_buff);
+ break;
+
+ case EINVAL:
+ printf("strerror_s() failed: invalid error code, %d\n",
+ error_num);
+ break;
+
+ case ERANGE:
+ printf("strerror_s() failed: buffer too small: %d\n",
+ ERR_MSG_LEN);
+ break;
+ }
+}
+
+/*
+ * Combine directory and file name.
+ * Write full path to memory.
+ */
+static void get_full_path(const char* dirname, const char* filename, char* buffer)
+{
+ char* dest = buffer;
+ char* end = &buffer[PATH_MAX];
+
+ /* Copy directory name to buffer */
+ const char* src = dirname;
+ while (dest < end && *src != '\0') {
+ *dest++ = *src++;
+ }
+ *dest = '\0';
+
+ char* new_dest = dest;
+ char c;
+
+ /* Get final character of directory name */
+ if (buffer < new_dest)
+ c = new_dest[-1];
+ else
+ c = ':';
+
+ /* Append directory separator if not already there */
+ if (c != ':' && c != '/' && c != '\\')
+ *new_dest++ = '/';
+
+ /* Append file name */
+ src = filename;
+ while (new_dest < end && *src != '\0') {
+ *new_dest++ = *src++;
+ }
+ *new_dest = '\0';
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/find.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/find.c
new file mode 100644
index 00000000..a5a6b267
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/find.c
@@ -0,0 +1,130 @@
+/*
+ * An example demonstrating recursive directory traversal.
+ *
+ * Compile this file with Visual Studio and run the produced command in
+ * console with a directory name argument. For example, command
+ *
+ * find "C:\Program Files"
+ *
+ * will output thousands of file names such as
+ *
+ * c:\Program Files/7-Zip/7-zip.chm
+ * c:\Program Files/7-Zip/7-zip.dll
+ * c:\Program Files/7-Zip/7z.dll
+ * c:\Program Files/Adobe/Reader 10.0/Reader/logsession.dll
+ * c:\Program Files/Adobe/Reader 10.0/Reader/LogTransport2.exe
+ * c:\Program Files/Windows NT/Accessories/wordpad.exe
+ * c:\Program Files/Windows NT/Accessories/write.wpc
+ *
+ * The find command provided by this file is only an example: the command does
+ * not provide options to restrict the output to certain files as the Linux
+ * version does.
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#define _CRT_SECURE_NO_WARNINGS
+#include
+#include
+#include
+#include
+#include
+#include
+
+static int find_directory(const char *dirname);
+
+
+int main(int argc, char *argv[])
+{
+ /* Select default locale */
+ setlocale(LC_ALL, "");
+
+ /* For each directory in command line */
+ int i = 1;
+ while (i < argc) {
+ if (!find_directory(argv[i]))
+ exit(EXIT_FAILURE);
+ i++;
+ }
+
+ /* List current working directory if no arguments on command line */
+ if (argc == 1)
+ find_directory(".");
+
+ return EXIT_SUCCESS;
+}
+
+/* Find files and subdirectories recursively */
+static int find_directory(const char *dirname)
+{
+ char buffer[PATH_MAX + 2];
+ char *p = buffer;
+ char *end = &buffer[PATH_MAX];
+
+ /* Copy directory name to buffer */
+ const char *src = dirname;
+ while (p < end && *src != '\0') {
+ *p++ = *src++;
+ }
+ *p = '\0';
+
+ /* Open directory stream */
+ DIR *dir = opendir(dirname);
+ if (!dir) {
+ /* Could not open directory */
+ fprintf(stderr,
+ "Cannot open %s (%s)\n", dirname, strerror(errno));
+ return /*failure*/ 0;
+ }
+
+ /* Print all files and directories within the directory */
+ struct dirent *ent;
+ while ((ent = readdir(dir)) != NULL) {
+ char *q = p;
+ char c;
+
+ /* Get final character of directory name */
+ if (buffer < q)
+ c = q[-1];
+ else
+ c = ':';
+
+ /* Append directory separator if not already there */
+ if (c != ':' && c != '/' && c != '\\')
+ *q++ = '/';
+
+ /* Append file name */
+ src = ent->d_name;
+ while (q < end && *src != '\0') {
+ *q++ = *src++;
+ }
+ *q = '\0';
+
+ /* Decide what to do with the directory entry */
+ switch (ent->d_type) {
+ case DT_LNK:
+ case DT_REG:
+ /* Output file name with directory */
+ printf("%s\n", buffer);
+ break;
+
+ case DT_DIR:
+ /* Scan sub-directory recursively */
+ if (strcmp(ent->d_name, ".") != 0
+ && strcmp(ent->d_name, "..") != 0) {
+ find_directory(buffer);
+ }
+ break;
+
+ default:
+ /* Ignore device entries */
+ /*NOP*/;
+ }
+
+ }
+
+ closedir(dir);
+ return /*success*/ 1;
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/locate.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/locate.c
new file mode 100644
index 00000000..556871a2
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/locate.c
@@ -0,0 +1,259 @@
+/*
+ * A file look-up utility to complement updatedb
+ *
+ * Compile and run updatedb command first to create locate.db file. Then,
+ * compile this program with Visual Studio and run the program in console with
+ * a file name argument. For example, the command
+ *
+ * locate autoexec
+ *
+ * might output something like
+ *
+ * c:/AUTOEXEC.BAT
+ * c:/WINDOWS/repair/autoexec.nt
+ * c:/WINDOWS/system32/AUTOEXEC.NT
+ *
+ * Be ware that this file uses wide-character API which is not compatible
+ * with Linux or other major Unixes.
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#include
+#include
+#include
+#include
+#ifdef WIN32
+# include
+# include
+#endif
+#include
+
+/* File name and location of database file */
+#define DB_LOCATION L"locate.db"
+
+
+/* Forward-decl */
+static int db_locate(const wchar_t *pattern);
+static int db_match(const wchar_t *fn, const wchar_t *pattern);
+static void db_open(void);
+static void db_close(void);
+static int db_read(wchar_t *buffer, size_t max);
+
+
+/* Module local variables */
+static FILE *db = NULL;
+
+int main(int argc, char *argv[])
+{
+#ifdef WIN32
+ /* Prepare for unicode output */
+ _setmode(_fileno(stdout), _O_U16TEXT);
+
+ /* For each pattern in command line */
+ int i = 1;
+ while (i < argc) {
+ wchar_t buffer[PATH_MAX + 1];
+ size_t n;
+ int count = 0;
+
+ /* Convert ith argument to wide-character string */
+ errno_t error = mbstowcs_s(&n, buffer, PATH_MAX, argv[i], _TRUNCATE);
+ if (!error) {
+ /* Find files matching pattern */
+ count = db_locate(buffer);
+
+ /* Output warning if string is not found */
+ if (count == 0) {
+ wprintf(L"%s not found\n", buffer);
+ }
+ }
+
+ i++;
+ }
+
+ if (argc < 2) {
+ wprintf(L"Usage: locate pattern\n");
+ exit(EXIT_FAILURE);
+ }
+#else
+ printf("locate only works on Microsoft Windows\n");
+#endif
+ return EXIT_SUCCESS;
+}
+
+/* Match pattern against files in locate.db file */
+static int db_locate(const wchar_t *pattern)
+{
+ int count = 0;
+
+#ifdef WIN32
+ wchar_t buffer[PATH_MAX + 1];
+
+ /* Open locate.db for read */
+ db_open();
+
+ /* Read one directory and file name at a time from database file */
+ while (db_read(buffer, PATH_MAX + 1)) {
+ /* See if file name in buffer matches the search pattern */
+ if (db_match(buffer, pattern)) {
+ /* Match found => output file name and path */
+ wprintf(L"%s\n", buffer);
+ count++;
+ }
+ }
+
+ db_close();
+#endif
+
+ return count;
+}
+
+/* Match pattern against file name */
+static int db_match(const wchar_t *fn, const wchar_t *pattern)
+{
+ int found = 0;
+
+#ifdef WIN32
+ /* Locate zero-terminator from fn */
+ wchar_t *p = wcschr(fn, '\0');
+
+ /* Find base name from buffer */
+ int done = 0;
+ while (fn < p && !done) {
+ switch (p[-1]) {
+ case ':':
+ case '/':
+ case '\\':
+ /* Final path separator found */
+ done = 1;
+ break;
+
+ default:
+ /* No path separator yet */
+ p--;
+ }
+ }
+
+ /* Convert base name to lower case */
+ int i = 0;
+ wchar_t base[PATH_MAX + 1];
+ while (i < PATH_MAX && p[i] != '\0') {
+ base[i] = towlower(p[i]);
+ i++;
+ }
+ base[i] = '\0';
+
+ /* Convert search pattern to lower case */
+ i = 0;
+ wchar_t patt[PATH_MAX + 1];
+ while (i < PATH_MAX && pattern[i] != '\0') {
+ patt[i] = towlower(pattern[i]);
+ i++;
+ }
+ patt[i] = '\0';
+
+ /* See if file name matches pattern */
+ if (wcsstr(base, patt) != NULL) {
+ found = 1;
+ } else {
+ found = 0;
+ }
+#endif
+
+ return found;
+}
+
+/*
+ * Read line from locate.db. This function is same as fgetws() except
+ * that new-line at the end of line is not included.
+ */
+static int db_read(wchar_t *buffer, size_t max)
+{
+ int ok = 0;
+
+#ifdef WIN32
+ size_t i = 0;
+ wchar_t c;
+ int done = 0;
+
+ if (!db) {
+ wprintf(L"Database not open\n");
+ exit(EXIT_SUCCESS);
+ }
+
+ do {
+ /* Read wide-character from stream */
+ c = fgetwc(db);
+
+ /* Determine how to process character */
+ switch (c) {
+ case '\r':
+ /* Ignore, should be handled by run-time libraries */
+ /*NOP*/;
+ break;
+
+ case '\n':
+ /* End of string => return file name */
+ done = 1;
+ ok = 1;
+ break;
+
+ case /*EOF*/WEOF:
+ /* End of file */
+ done = 1;
+ if (i == 0) {
+ /* No data in buffer => return false */
+ ok = 0;
+ } else {
+ /* Data in buffer => return file name */
+ ok = 1;
+ }
+ break;
+
+ default:
+ /* Store character */
+ if (i < max - 1) {
+ buffer[i++] = c;
+ } else {
+ buffer[max - 1] = '\0';
+ wprintf(L"Buffer too small: %s", buffer);
+ exit(EXIT_FAILURE);
+ }
+ }
+ } while (!done);
+
+ /* Zero-terminate buffer */
+ buffer[i] = '\0';
+#endif
+
+ return ok;
+}
+
+/* Open database file locate.db */
+static void db_open(void)
+{
+#ifdef WIN32
+ if (db)
+ return;
+
+ /* Open file for writing */
+ errno_t error = _wfopen_s(&db, DB_LOCATION, L"rt, ccs=UNICODE");
+ if (error) {
+ wprintf(L"Cannot open %s\n", DB_LOCATION);
+ exit(EXIT_FAILURE);
+ }
+#endif
+}
+
+/* Close database file */
+static void db_close(void)
+{
+ if (!db)
+ return;
+
+ fclose(db);
+ db = NULL;
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/ls.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/ls.c
new file mode 100644
index 00000000..d1fccf32
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/ls.c
@@ -0,0 +1,94 @@
+/*
+ * An example demonstrating basic directory listing.
+ *
+ * Compile this file with Visual Studio and run the produced command in
+ * console with a directory name argument. For example, command
+ *
+ * ls "c:\Program Files"
+ *
+ * might output something like
+ *
+ * ./
+ * ../
+ * 7-Zip/
+ * Internet Explorer/
+ * Microsoft Visual Studio 9.0/
+ * Microsoft.NET/
+ * Mozilla Firefox/
+ *
+ * The ls command provided by this file is only an example: the command does
+ * not have any fancy options like "ls -al" in Linux and the command does not
+ * support file name matching like "ls *.c".
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#define _CRT_SECURE_NO_WARNINGS
+#include
+#include
+#include
+#include
+#include
+#include
+
+static void list_directory(const char *dirname);
+
+
+int main(int argc, char *argv[])
+{
+ /* Select default locale */
+ setlocale(LC_ALL, "");
+
+ /* For each directory in command line */
+ int i = 1;
+ while (i < argc) {
+ list_directory(argv[i]);
+ i++;
+ }
+
+ /* List current working directory if no arguments on command line */
+ if (argc == 1)
+ list_directory(".");
+
+ return EXIT_SUCCESS;
+}
+
+/*
+ * List files and directories within a directory.
+ */
+static void list_directory(const char *dirname)
+{
+ /* Open directory stream */
+ DIR *dir = opendir(dirname);
+ if (!dir) {
+ /* Could not open directory */
+ fprintf(stderr,
+ "Cannot open %s (%s)\n", dirname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ /* Print all files and directories within the directory */
+ struct dirent *ent;
+ while ((ent = readdir(dir)) != NULL) {
+ switch (ent->d_type) {
+ case DT_REG:
+ printf("%s\n", ent->d_name);
+ break;
+
+ case DT_DIR:
+ printf("%s/\n", ent->d_name);
+ break;
+
+ case DT_LNK:
+ printf("%s@\n", ent->d_name);
+ break;
+
+ default:
+ printf("%s*\n", ent->d_name);
+ }
+ }
+
+ closedir(dir);
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/scandir.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/scandir.c
new file mode 100644
index 00000000..0f776203
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/scandir.c
@@ -0,0 +1,100 @@
+/*
+ * Example program demonstrating the use of scandir function.
+ *
+ * Compile this file with Visual Studio and run the produced command in
+ * console with a directory name argument. For example, command
+ *
+ * scandir "c:\Program Files"
+ *
+ * might output something like
+ *
+ * ./
+ * ../
+ * 7-Zip/
+ * Internet Explorer/
+ * Microsoft Visual Studio 9.0/
+ * Microsoft.NET/
+ * Mozilla Firefox/
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#define _CRT_SECURE_NO_WARNINGS
+#include
+#include
+#include
+#include
+#include
+#include
+
+static void list_directory(const char *dirname);
+
+
+int main(int argc, char *argv[])
+{
+ /* Select default locale */
+ setlocale(LC_ALL, "");
+
+ /* For each directory in command line */
+ int i = 1;
+ while (i < argc) {
+ list_directory(argv[i]);
+ i++;
+ }
+
+ /* List current working directory if no arguments on command line */
+ if (argc == 1)
+ list_directory(".");
+
+ return EXIT_SUCCESS;
+}
+
+/*
+ * List files and directories within a directory.
+ */
+static void
+list_directory(
+ const char *dirname)
+{
+ /* Scan files in directory */
+ struct dirent **files;
+ int n = scandir(dirname, &files, NULL, alphasort);
+ if (n < 0) {
+ fprintf(stderr,
+ "Cannot open %s (%s)\n", dirname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ /* Loop through file names */
+ for (int i = 0; i < n; i++) {
+ /* Get pointer to file entry */
+ struct dirent *ent = files[i];
+
+ /* Output file name */
+ switch (ent->d_type) {
+ case DT_REG:
+ printf("%s\n", ent->d_name);
+ break;
+
+ case DT_DIR:
+ printf("%s/\n", ent->d_name);
+ break;
+
+ case DT_LNK:
+ printf("%s@\n", ent->d_name);
+ break;
+
+ default:
+ printf("%s*\n", ent->d_name);
+ }
+
+ }
+
+ /* Release file names */
+ for (int i = 0; i < n; i++) {
+ free(files[i]);
+ }
+ free(files);
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/updatedb.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/updatedb.c
new file mode 100644
index 00000000..74a35335
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/examples/updatedb.c
@@ -0,0 +1,211 @@
+/*
+ * An example demonstrating wide-character functions
+ *
+ * Compile this file with Visual Studio and run the produced command in
+ * console with a directory name argument. For example, command
+ *
+ * updatedb C:\
+ *
+ * will produce the file locate.db with one file name per line such as
+ *
+ * c:\Program Files/7-Zip/7-zip.chm
+ * c:\Program Files/7-Zip/7-zip.dll
+ * c:\Program Files/7-Zip/7z.dll
+ * c:\Program Files/Adobe/Reader 10.0/Reader/logsession.dll
+ * c:\Program Files/Adobe/Reader 10.0/Reader/LogTransport2.exe
+ * c:\Program Files/Windows NT/Accessories/wordpad.exe
+ * c:\Program Files/Windows NT/Accessories/write.wpc
+ *
+ * Be ware that this file uses wide-character API which is not compatible
+ * with Linux or other major Unixes.
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#include
+#include
+#include
+#include
+#ifdef WIN32
+# include
+# include
+#endif
+#include
+
+/* File name and location of database file */
+#define DB_LOCATION L"locate.db"
+
+
+/* Forward-decl */
+static int update_directory(const wchar_t *dirname);
+static void db_open(void);
+static void db_close(void);
+static void db_store(const wchar_t *dirname);
+
+
+/* Module local variables */
+static FILE *db = NULL;
+
+
+int main(int argc, char *argv[])
+{
+#ifdef WIN32
+ /* Prepare for unicode output */
+ _setmode(_fileno(stdout), _O_U16TEXT);
+
+ /* Open locate.db */
+ db_open();
+
+ /* For each directory in command line */
+ int i = 1;
+ while (i < argc) {
+ wchar_t buffer[PATH_MAX + 1];
+ errno_t error;
+ size_t n;
+
+ /* Convert ith argument to wide-character string */
+ error = mbstowcs_s(&n, buffer, PATH_MAX, argv[i], _TRUNCATE);
+ if (!error) {
+
+ /* Scan directory for files */
+ int ok = update_directory(buffer);
+ if (!ok) {
+ wprintf(L"Cannot open directory %s\n", buffer);
+ exit(EXIT_FAILURE);
+ }
+
+ }
+
+ i++;
+ }
+
+ /* Use current working directory if no arguments on command line */
+ if (argc == 1)
+ update_directory(L".");
+
+ db_close();
+#else
+ printf("updatedb only works on Microsoft Windows\n");
+#endif
+ return EXIT_SUCCESS;
+}
+
+/* Find files recursively */
+static int update_directory(const wchar_t *dirname)
+{
+#ifdef WIN32
+ wchar_t buffer[PATH_MAX + 2];
+ wchar_t *p = buffer;
+ wchar_t *end = &buffer[PATH_MAX];
+
+ /* Copy directory name to buffer */
+ const wchar_t *src = dirname;
+ while (p < end && *src != '\0') {
+ *p++ = *src++;
+ }
+ *p = '\0';
+
+ /* Open directory stream */
+ _WDIR *dir = _wopendir(dirname);
+ if (!dir) {
+ /* Cannot open directory */
+ return /*failure*/ 0;
+ }
+
+ /* Print all files and directories within the directory */
+ struct _wdirent *ent;
+ while ((ent = _wreaddir (dir)) != NULL) {
+ wchar_t *q = p;
+ wchar_t c;
+
+ /* Get final character of directory name */
+ if (buffer < q)
+ c = q[-1];
+ else
+ c = ':';
+
+ /* Append directory separator if not already there */
+ if (c != ':' && c != '/' && c != '\\')
+ *q++ = '/';
+
+ /* Append file name */
+ src = ent->d_name;
+ while (q < end && *src != '\0') {
+ *q++ = *src++;
+ }
+ *q = '\0';
+
+ /* Decide what to do with the directory entry */
+ switch (ent->d_type) {
+ case DT_REG:
+ /* Store file name */
+ db_store(buffer);
+ break;
+
+ case DT_DIR:
+ /* Scan sub-directory recursively */
+ if (wcscmp(ent->d_name, L".") != 0
+ && wcscmp(ent->d_name, L"..") != 0) {
+ update_directory(buffer);
+ }
+ break;
+
+ default:
+ /* Do not device entries */
+ /*NOP*/;
+ }
+
+ }
+
+ wclosedir(dir);
+ return /*success*/ 1;
+#else
+ return /*failure*/ 0;
+#endif
+}
+
+/* Store file name to locate.db */
+static void db_store(const wchar_t *dirname)
+{
+#ifdef WIN32
+ if (!db) {
+ wprintf(L"Database not open\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Output line to file */
+ fwprintf(db, L"%s\n", dirname);
+#endif
+}
+
+/* Open database file locate.db */
+static void db_open(void)
+{
+#ifdef WIN32
+ if (db)
+ return;
+
+ /* Open file for writing */
+ errno_t error = _wfopen_s(&db, DB_LOCATION, L"wt, ccs=UNICODE");
+ if (error) {
+ wprintf(L"Cannot open %s\n", DB_LOCATION);
+ exit(EXIT_FAILURE);
+ }
+#endif
+}
+
+/* Close database file */
+static void
+db_close(
+ void)
+{
+ if (!db) {
+ return;
+ }
+
+ /* Close file */
+ fclose(db);
+ db = NULL;
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/include/dirent.h b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/include/dirent.h
new file mode 100644
index 00000000..a2e847a0
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/include/dirent.h
@@ -0,0 +1,1027 @@
+/*
+ * Dirent interface for Microsoft Visual Studio
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#ifndef DIRENT_H
+#define DIRENT_H
+
+/* Hide warnings about unreferenced local functions */
+#if defined(__clang__)
+# pragma clang diagnostic ignored "-Wunused-function"
+#elif defined(_MSC_VER)
+# pragma warning(disable:4505)
+#elif defined(__GNUC__)
+# pragma GCC diagnostic ignored "-Wunused-function"
+#endif
+
+/*
+ * Include windows.h without Windows Sockets 1.1 to prevent conflicts with
+ * Windows Sockets 2.0.
+ */
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* Indicates that d_type field is available in dirent structure */
+#define _DIRENT_HAVE_D_TYPE
+
+/* Indicates that d_namlen field is available in dirent structure */
+#define _DIRENT_HAVE_D_NAMLEN
+
+/* Entries missing from MSVC 6.0 */
+#if !defined(FILE_ATTRIBUTE_DEVICE)
+# define FILE_ATTRIBUTE_DEVICE 0x40
+#endif
+
+/* File type and permission flags for stat(), general mask */
+#if !defined(S_IFMT)
+# define S_IFMT _S_IFMT
+#endif
+
+/* Directory bit */
+#if !defined(S_IFDIR)
+# define S_IFDIR _S_IFDIR
+#endif
+
+/* Character device bit */
+#if !defined(S_IFCHR)
+# define S_IFCHR _S_IFCHR
+#endif
+
+/* Pipe bit */
+#if !defined(S_IFFIFO)
+# define S_IFFIFO _S_IFFIFO
+#endif
+
+/* Regular file bit */
+#if !defined(S_IFREG)
+# define S_IFREG _S_IFREG
+#endif
+
+/* Read permission */
+#if !defined(S_IREAD)
+# define S_IREAD _S_IREAD
+#endif
+
+/* Write permission */
+#if !defined(S_IWRITE)
+# define S_IWRITE _S_IWRITE
+#endif
+
+/* Execute permission */
+#if !defined(S_IEXEC)
+# define S_IEXEC _S_IEXEC
+#endif
+
+/* Pipe */
+#if !defined(S_IFIFO)
+# define S_IFIFO _S_IFIFO
+#endif
+
+/* Block device */
+#if !defined(S_IFBLK)
+# define S_IFBLK 0
+#endif
+
+/* Link */
+#if !defined(S_IFLNK)
+# define S_IFLNK 0
+#endif
+
+/* Socket */
+#if !defined(S_IFSOCK)
+# define S_IFSOCK 0
+#endif
+
+/* Read user permission */
+#if !defined(S_IRUSR)
+# define S_IRUSR S_IREAD
+#endif
+
+/* Write user permission */
+#if !defined(S_IWUSR)
+# define S_IWUSR S_IWRITE
+#endif
+
+/* Execute user permission */
+#if !defined(S_IXUSR)
+# define S_IXUSR 0
+#endif
+
+/* Read group permission */
+#if !defined(S_IRGRP)
+# define S_IRGRP 0
+#endif
+
+/* Write group permission */
+#if !defined(S_IWGRP)
+# define S_IWGRP 0
+#endif
+
+/* Execute group permission */
+#if !defined(S_IXGRP)
+# define S_IXGRP 0
+#endif
+
+/* Read others permission */
+#if !defined(S_IROTH)
+# define S_IROTH 0
+#endif
+
+/* Write others permission */
+#if !defined(S_IWOTH)
+# define S_IWOTH 0
+#endif
+
+/* Execute others permission */
+#if !defined(S_IXOTH)
+# define S_IXOTH 0
+#endif
+
+/* Maximum length of file name */
+#if !defined(PATH_MAX)
+# define PATH_MAX MAX_PATH
+#endif
+#if !defined(FILENAME_MAX)
+# define FILENAME_MAX MAX_PATH
+#endif
+#if !defined(NAME_MAX)
+# define NAME_MAX FILENAME_MAX
+#endif
+
+/* File type flags for d_type */
+#define DT_UNKNOWN 0
+#define DT_REG S_IFREG
+#define DT_DIR S_IFDIR
+#define DT_FIFO S_IFIFO
+#define DT_SOCK S_IFSOCK
+#define DT_CHR S_IFCHR
+#define DT_BLK S_IFBLK
+#define DT_LNK S_IFLNK
+
+/* Macros for converting between st_mode and d_type */
+#define IFTODT(mode) ((mode) & S_IFMT)
+#define DTTOIF(type) (type)
+
+/*
+ * File type macros. Note that block devices, sockets and links cannot be
+ * distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
+ * only defined for compatibility. These macros should always return false
+ * on Windows.
+ */
+#if !defined(S_ISFIFO)
+# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
+#endif
+#if !defined(S_ISDIR)
+# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+#endif
+#if !defined(S_ISREG)
+# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
+#endif
+#if !defined(S_ISLNK)
+# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
+#endif
+#if !defined(S_ISSOCK)
+# define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
+#endif
+#if !defined(S_ISCHR)
+# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
+#endif
+#if !defined(S_ISBLK)
+# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
+#endif
+
+/* Return the exact length of the file name without zero terminator */
+#define _D_EXACT_NAMLEN(p) ((p)->d_namlen)
+
+/* Return the maximum size of a file name */
+#define _D_ALLOC_NAMLEN(p) ((PATH_MAX)+1)
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Wide-character version */
+struct _wdirent {
+ /* Always zero */
+ long d_ino;
+
+ /* File position within stream */
+ long d_off;
+
+ /* Structure size */
+ unsigned short d_reclen;
+
+ /* Length of name without \0 */
+ size_t d_namlen;
+
+ /* File type */
+ int d_type;
+
+ /* File name */
+ wchar_t d_name[PATH_MAX+1];
+};
+typedef struct _wdirent _wdirent;
+
+struct _WDIR {
+ /* Current directory entry */
+ struct _wdirent ent;
+
+ /* Private file data */
+ WIN32_FIND_DATAW data;
+
+ /* True if data is valid */
+ int cached;
+
+ /* Win32 search handle */
+ HANDLE handle;
+
+ /* Initial directory name */
+ wchar_t *patt;
+};
+typedef struct _WDIR _WDIR;
+
+/* Multi-byte character version */
+struct dirent {
+ /* Always zero */
+ long d_ino;
+
+ /* File position within stream */
+ long d_off;
+
+ /* Structure size */
+ unsigned short d_reclen;
+
+ /* Length of name without \0 */
+ size_t d_namlen;
+
+ /* File type */
+ int d_type;
+
+ /* File name */
+ char d_name[PATH_MAX+1];
+};
+typedef struct dirent dirent;
+
+struct DIR {
+ struct dirent ent;
+ struct _WDIR *wdirp;
+};
+typedef struct DIR DIR;
+
+
+/* Dirent functions */
+static DIR *opendir(const char *dirname);
+static _WDIR *_wopendir(const wchar_t *dirname);
+
+static struct dirent *readdir(DIR *dirp);
+static struct _wdirent *_wreaddir(_WDIR *dirp);
+
+static int readdir_r(
+ DIR *dirp, struct dirent *entry, struct dirent **result);
+static int _wreaddir_r(
+ _WDIR *dirp, struct _wdirent *entry, struct _wdirent **result);
+
+static int closedir(DIR *dirp);
+static int _wclosedir(_WDIR *dirp);
+
+static void rewinddir(DIR* dirp);
+static void _wrewinddir(_WDIR* dirp);
+
+static int scandir(const char *dirname, struct dirent ***namelist,
+ int (*filter)(const struct dirent*),
+ int (*compare)(const struct dirent**, const struct dirent**));
+
+static int alphasort(const struct dirent **a, const struct dirent **b);
+
+static int versionsort(const struct dirent **a, const struct dirent **b);
+
+static int strverscmp(const char *a, const char *b);
+
+/* For compatibility with Symbian */
+#define wdirent _wdirent
+#define WDIR _WDIR
+#define wopendir _wopendir
+#define wreaddir _wreaddir
+#define wclosedir _wclosedir
+#define wrewinddir _wrewinddir
+
+/* Compatibility with older Microsoft compilers and non-Microsoft compilers */
+#if !defined(_MSC_VER) || _MSC_VER < 1400
+# define wcstombs_s dirent_wcstombs_s
+# define mbstowcs_s dirent_mbstowcs_s
+#endif
+
+/* Optimize dirent_set_errno() away on modern Microsoft compilers */
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+# define dirent_set_errno _set_errno
+#endif
+
+
+/* Internal utility functions */
+static WIN32_FIND_DATAW *dirent_first(_WDIR *dirp);
+static WIN32_FIND_DATAW *dirent_next(_WDIR *dirp);
+
+#if !defined(_MSC_VER) || _MSC_VER < 1400
+static int dirent_mbstowcs_s(
+ size_t *pReturnValue, wchar_t *wcstr, size_t sizeInWords,
+ const char *mbstr, size_t count);
+#endif
+
+#if !defined(_MSC_VER) || _MSC_VER < 1400
+static int dirent_wcstombs_s(
+ size_t *pReturnValue, char *mbstr, size_t sizeInBytes,
+ const wchar_t *wcstr, size_t count);
+#endif
+
+#if !defined(_MSC_VER) || _MSC_VER < 1400
+static void dirent_set_errno(int error);
+#endif
+
+
+/*
+ * Open directory stream DIRNAME for read and return a pointer to the
+ * internal working area that is used to retrieve individual directory
+ * entries.
+ */
+static _WDIR *_wopendir(const wchar_t *dirname)
+{
+ wchar_t *p;
+
+ /* Must have directory name */
+ if (dirname == NULL || dirname[0] == '\0') {
+ dirent_set_errno(ENOENT);
+ return NULL;
+ }
+
+ /* Allocate new _WDIR structure */
+ _WDIR *dirp = (_WDIR*) malloc(sizeof(struct _WDIR));
+ if (!dirp)
+ return NULL;
+
+ /* Reset _WDIR structure */
+ dirp->handle = INVALID_HANDLE_VALUE;
+ dirp->patt = NULL;
+ dirp->cached = 0;
+
+ /*
+ * Compute the length of full path plus zero terminator
+ *
+ * Note that on WinRT there's no way to convert relative paths
+ * into absolute paths, so just assume it is an absolute path.
+ */
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ /* Desktop */
+ DWORD n = GetFullPathNameW(dirname, 0, NULL, NULL);
+#else
+ /* WinRT */
+ size_t n = wcslen(dirname);
+#endif
+
+ /* Allocate room for absolute directory name and search pattern */
+ dirp->patt = (wchar_t*) malloc(sizeof(wchar_t) * n + 16);
+ if (dirp->patt == NULL)
+ goto exit_closedir;
+
+ /*
+ * Convert relative directory name to an absolute one. This
+ * allows rewinddir() to function correctly even when current
+ * working directory is changed between opendir() and rewinddir().
+ *
+ * Note that on WinRT there's no way to convert relative paths
+ * into absolute paths, so just assume it is an absolute path.
+ */
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ /* Desktop */
+ n = GetFullPathNameW(dirname, n, dirp->patt, NULL);
+ if (n <= 0)
+ goto exit_closedir;
+#else
+ /* WinRT */
+ wcsncpy_s(dirp->patt, n+1, dirname, n);
+#endif
+
+ /* Append search pattern \* to the directory name */
+ p = dirp->patt + n;
+ switch (p[-1]) {
+ case '\\':
+ case '/':
+ case ':':
+ /* Directory ends in path separator, e.g. c:\temp\ */
+ /*NOP*/;
+ break;
+
+ default:
+ /* Directory name doesn't end in path separator */
+ *p++ = '\\';
+ }
+ *p++ = '*';
+ *p = '\0';
+
+ /* Open directory stream and retrieve the first entry */
+ if (!dirent_first(dirp))
+ goto exit_closedir;
+
+ /* Success */
+ return dirp;
+
+ /* Failure */
+exit_closedir:
+ _wclosedir(dirp);
+ return NULL;
+}
+
+/*
+ * Read next directory entry.
+ *
+ * Returns pointer to static directory entry which may be overwritten by
+ * subsequent calls to _wreaddir().
+ */
+static struct _wdirent *_wreaddir(_WDIR *dirp)
+{
+ /*
+ * Read directory entry to buffer. We can safely ignore the return
+ * value as entry will be set to NULL in case of error.
+ */
+ struct _wdirent *entry;
+ (void) _wreaddir_r(dirp, &dirp->ent, &entry);
+
+ /* Return pointer to statically allocated directory entry */
+ return entry;
+}
+
+/*
+ * Read next directory entry.
+ *
+ * Returns zero on success. If end of directory stream is reached, then sets
+ * result to NULL and returns zero.
+ */
+static int _wreaddir_r(
+ _WDIR *dirp, struct _wdirent *entry, struct _wdirent **result)
+{
+ /* Read next directory entry */
+ WIN32_FIND_DATAW *datap = dirent_next(dirp);
+ if (!datap) {
+ /* Return NULL to indicate end of directory */
+ *result = NULL;
+ return /*OK*/0;
+ }
+
+ /*
+ * Copy file name as wide-character string. If the file name is too
+ * long to fit in to the destination buffer, then truncate file name
+ * to PATH_MAX characters and zero-terminate the buffer.
+ */
+ size_t n = 0;
+ while (n < PATH_MAX && datap->cFileName[n] != 0) {
+ entry->d_name[n] = datap->cFileName[n];
+ n++;
+ }
+ entry->d_name[n] = 0;
+
+ /* Length of file name excluding zero terminator */
+ entry->d_namlen = n;
+
+ /* File type */
+ DWORD attr = datap->dwFileAttributes;
+ if ((attr & FILE_ATTRIBUTE_DEVICE) != 0)
+ entry->d_type = DT_CHR;
+ else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0)
+ entry->d_type = DT_DIR;
+ else
+ entry->d_type = DT_REG;
+
+ /* Reset dummy fields */
+ entry->d_ino = 0;
+ entry->d_off = 0;
+ entry->d_reclen = sizeof(struct _wdirent);
+
+ /* Set result address */
+ *result = entry;
+ return /*OK*/0;
+}
+
+/*
+ * Close directory stream opened by opendir() function. This invalidates the
+ * DIR structure as well as any directory entry read previously by
+ * _wreaddir().
+ */
+static int _wclosedir(_WDIR *dirp)
+{
+ if (!dirp) {
+ dirent_set_errno(EBADF);
+ return /*failure*/-1;
+ }
+
+ /* Release search handle */
+ if (dirp->handle != INVALID_HANDLE_VALUE)
+ FindClose(dirp->handle);
+
+ /* Release search pattern */
+ free(dirp->patt);
+
+ /* Release directory structure */
+ free(dirp);
+ return /*success*/0;
+}
+
+/*
+ * Rewind directory stream such that _wreaddir() returns the very first
+ * file name again.
+ */
+static void _wrewinddir(_WDIR* dirp)
+{
+ if (!dirp)
+ return;
+
+ /* Release existing search handle */
+ if (dirp->handle != INVALID_HANDLE_VALUE)
+ FindClose(dirp->handle);
+
+ /* Open new search handle */
+ dirent_first(dirp);
+}
+
+/* Get first directory entry */
+static WIN32_FIND_DATAW *dirent_first(_WDIR *dirp)
+{
+ if (!dirp)
+ return NULL;
+
+ /* Open directory and retrieve the first entry */
+ dirp->handle = FindFirstFileExW(
+ dirp->patt, FindExInfoStandard, &dirp->data,
+ FindExSearchNameMatch, NULL, 0);
+ if (dirp->handle == INVALID_HANDLE_VALUE)
+ goto error;
+
+ /* A directory entry is now waiting in memory */
+ dirp->cached = 1;
+ return &dirp->data;
+
+error:
+ /* Failed to open directory: no directory entry in memory */
+ dirp->cached = 0;
+
+ /* Set error code */
+ DWORD errorcode = GetLastError();
+ switch (errorcode) {
+ case ERROR_ACCESS_DENIED:
+ /* No read access to directory */
+ dirent_set_errno(EACCES);
+ break;
+
+ case ERROR_DIRECTORY:
+ /* Directory name is invalid */
+ dirent_set_errno(ENOTDIR);
+ break;
+
+ case ERROR_PATH_NOT_FOUND:
+ default:
+ /* Cannot find the file */
+ dirent_set_errno(ENOENT);
+ }
+ return NULL;
+}
+
+/* Get next directory entry */
+static WIN32_FIND_DATAW *dirent_next(_WDIR *dirp)
+{
+ /* Is the next directory entry already in cache? */
+ if (dirp->cached) {
+ /* Yes, a valid directory entry found in memory */
+ dirp->cached = 0;
+ return &dirp->data;
+ }
+
+ /* No directory entry in cache */
+ if (dirp->handle == INVALID_HANDLE_VALUE)
+ return NULL;
+
+ /* Read the next directory entry from stream */
+ if (FindNextFileW(dirp->handle, &dirp->data) == FALSE)
+ goto exit_close;
+
+ /* Success */
+ return &dirp->data;
+
+ /* Failure */
+exit_close:
+ FindClose(dirp->handle);
+ dirp->handle = INVALID_HANDLE_VALUE;
+ return NULL;
+}
+
+/* Open directory stream using plain old C-string */
+static DIR *opendir(const char *dirname)
+{
+ /* Must have directory name */
+ if (dirname == NULL || dirname[0] == '\0') {
+ dirent_set_errno(ENOENT);
+ return NULL;
+ }
+
+ /* Allocate memory for DIR structure */
+ struct DIR *dirp = (DIR*) malloc(sizeof(struct DIR));
+ if (!dirp)
+ return NULL;
+
+ /* Convert directory name to wide-character string */
+ wchar_t wname[PATH_MAX + 1];
+ size_t n;
+ int error = mbstowcs_s(&n, wname, PATH_MAX + 1, dirname, PATH_MAX+1);
+ if (error)
+ goto exit_failure;
+
+ /* Open directory stream using wide-character name */
+ dirp->wdirp = _wopendir(wname);
+ if (!dirp->wdirp)
+ goto exit_failure;
+
+ /* Success */
+ return dirp;
+
+ /* Failure */
+exit_failure:
+ free(dirp);
+ return NULL;
+}
+
+/* Read next directory entry */
+static struct dirent *readdir(DIR *dirp)
+{
+ /*
+ * Read directory entry to buffer. We can safely ignore the return
+ * value as entry will be set to NULL in case of error.
+ */
+ struct dirent *entry;
+ (void) readdir_r(dirp, &dirp->ent, &entry);
+
+ /* Return pointer to statically allocated directory entry */
+ return entry;
+}
+
+/*
+ * Read next directory entry into called-allocated buffer.
+ *
+ * Returns zero on success. If the end of directory stream is reached, then
+ * sets result to NULL and returns zero.
+ */
+static int readdir_r(
+ DIR *dirp, struct dirent *entry, struct dirent **result)
+{
+ /* Read next directory entry */
+ WIN32_FIND_DATAW *datap = dirent_next(dirp->wdirp);
+ if (!datap) {
+ /* No more directory entries */
+ *result = NULL;
+ return /*OK*/0;
+ }
+
+ /* Attempt to convert file name to multi-byte string */
+ size_t n;
+ int error = wcstombs_s(
+ &n, entry->d_name, PATH_MAX + 1,
+ datap->cFileName, PATH_MAX + 1);
+
+ /*
+ * If the file name cannot be represented by a multi-byte string, then
+ * attempt to use old 8+3 file name. This allows the program to
+ * access files although file names may seem unfamiliar to the user.
+ *
+ * Be ware that the code below cannot come up with a short file name
+ * unless the file system provides one. At least VirtualBox shared
+ * folders fail to do this.
+ */
+ if (error && datap->cAlternateFileName[0] != '\0') {
+ error = wcstombs_s(
+ &n, entry->d_name, PATH_MAX + 1,
+ datap->cAlternateFileName, PATH_MAX + 1);
+ }
+
+ if (!error) {
+ /* Length of file name excluding zero terminator */
+ entry->d_namlen = n - 1;
+
+ /* File attributes */
+ DWORD attr = datap->dwFileAttributes;
+ if ((attr & FILE_ATTRIBUTE_DEVICE) != 0)
+ entry->d_type = DT_CHR;
+ else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0)
+ entry->d_type = DT_DIR;
+ else
+ entry->d_type = DT_REG;
+
+ /* Reset dummy fields */
+ entry->d_ino = 0;
+ entry->d_off = 0;
+ entry->d_reclen = sizeof(struct dirent);
+ } else {
+ /*
+ * Cannot convert file name to multi-byte string so construct
+ * an erroneous directory entry and return that. Note that
+ * we cannot return NULL as that would stop the processing
+ * of directory entries completely.
+ */
+ entry->d_name[0] = '?';
+ entry->d_name[1] = '\0';
+ entry->d_namlen = 1;
+ entry->d_type = DT_UNKNOWN;
+ entry->d_ino = 0;
+ entry->d_off = -1;
+ entry->d_reclen = 0;
+ }
+
+ /* Return pointer to directory entry */
+ *result = entry;
+ return /*OK*/0;
+}
+
+/* Close directory stream */
+static int closedir(DIR *dirp)
+{
+ int ok;
+
+ if (!dirp)
+ goto exit_failure;
+
+ /* Close wide-character directory stream */
+ ok = _wclosedir(dirp->wdirp);
+ dirp->wdirp = NULL;
+
+ /* Release multi-byte character version */
+ free(dirp);
+ return ok;
+
+exit_failure:
+ /* Invalid directory stream */
+ dirent_set_errno(EBADF);
+ return /*failure*/-1;
+}
+
+/* Rewind directory stream to beginning */
+static void rewinddir(DIR* dirp)
+{
+ if (!dirp)
+ return;
+
+ /* Rewind wide-character string directory stream */
+ _wrewinddir(dirp->wdirp);
+}
+
+/* Scan directory for entries */
+static int scandir(
+ const char *dirname, struct dirent ***namelist,
+ int (*filter)(const struct dirent*),
+ int (*compare)(const struct dirent**, const struct dirent**))
+{
+ int result;
+
+ /* Open directory stream */
+ DIR *dir = opendir(dirname);
+ if (!dir) {
+ /* Cannot open directory */
+ return /*Error*/ -1;
+ }
+
+ /* Read directory entries to memory */
+ struct dirent *tmp = NULL;
+ struct dirent **files = NULL;
+ size_t size = 0;
+ size_t allocated = 0;
+ while (1) {
+ /* Allocate room for a temporary directory entry */
+ if (!tmp) {
+ tmp = (struct dirent*) malloc(sizeof(struct dirent));
+ if (!tmp)
+ goto exit_failure;
+ }
+
+ /* Read directory entry to temporary area */
+ struct dirent *entry;
+ if (readdir_r(dir, tmp, &entry) != /*OK*/0)
+ goto exit_failure;
+
+ /* Stop if we already read the last directory entry */
+ if (entry == NULL)
+ goto exit_success;
+
+ /* Determine whether to include the entry in results */
+ if (filter && !filter(tmp))
+ continue;
+
+ /* Enlarge pointer table to make room for another pointer */
+ if (size >= allocated) {
+ /* Compute number of entries in the new table */
+ size_t num_entries = size * 2 + 16;
+
+ /* Allocate new pointer table or enlarge existing */
+ void *p = realloc(files, sizeof(void*) * num_entries);
+ if (!p)
+ goto exit_failure;
+
+ /* Got the memory */
+ files = (dirent**) p;
+ allocated = num_entries;
+ }
+
+ /* Store the temporary entry to ptr table */
+ files[size++] = tmp;
+ tmp = NULL;
+ }
+
+exit_failure:
+ /* Release allocated file entries */
+ for (size_t i = 0; i < size; i++) {
+ free(files[i]);
+ }
+
+ /* Release the pointer table */
+ free(files);
+ files = NULL;
+
+ /* Exit with error code */
+ result = /*error*/ -1;
+ goto exit_status;
+
+exit_success:
+ /* Sort directory entries */
+ qsort(files, size, sizeof(void*),
+ (int (*) (const void*, const void*)) compare);
+
+ /* Pass pointer table to caller */
+ if (namelist)
+ *namelist = files;
+
+ /* Return the number of directory entries read */
+ result = (int) size;
+
+exit_status:
+ /* Release temporary directory entry, if we had one */
+ free(tmp);
+
+ /* Close directory stream */
+ closedir(dir);
+ return result;
+}
+
+/* Alphabetical sorting */
+static int alphasort(const struct dirent **a, const struct dirent **b)
+{
+ return strcoll((*a)->d_name, (*b)->d_name);
+}
+
+/* Sort versions */
+static int versionsort(const struct dirent **a, const struct dirent **b)
+{
+ return strverscmp((*a)->d_name, (*b)->d_name);
+}
+
+/* Compare strings */
+static int strverscmp(const char *a, const char *b)
+{
+ size_t i = 0;
+ size_t j;
+
+ /* Find first difference */
+ while (a[i] == b[i]) {
+ if (a[i] == '\0') {
+ /* No difference */
+ return 0;
+ }
+ ++i;
+ }
+
+ /* Count backwards and find the leftmost digit */
+ j = i;
+ while (j > 0 && isdigit(a[j-1])) {
+ --j;
+ }
+
+ /* Determine mode of comparison */
+ if (a[j] == '0' || b[j] == '0') {
+ /* Find the next non-zero digit */
+ while (a[j] == '0' && a[j] == b[j]) {
+ j++;
+ }
+
+ /* String with more digits is smaller, e.g 002 < 01 */
+ if (isdigit(a[j])) {
+ if (!isdigit(b[j])) {
+ return -1;
+ }
+ } else if (isdigit(b[j])) {
+ return 1;
+ }
+ } else if (isdigit(a[j]) && isdigit(b[j])) {
+ /* Numeric comparison */
+ size_t k1 = j;
+ size_t k2 = j;
+
+ /* Compute number of digits in each string */
+ while (isdigit(a[k1])) {
+ k1++;
+ }
+ while (isdigit(b[k2])) {
+ k2++;
+ }
+
+ /* Number with more digits is bigger, e.g 999 < 1000 */
+ if (k1 < k2)
+ return -1;
+ else if (k1 > k2)
+ return 1;
+ }
+
+ /* Alphabetical comparison */
+ return (int) ((unsigned char) a[i]) - ((unsigned char) b[i]);
+}
+
+/* Convert multi-byte string to wide character string */
+#if !defined(_MSC_VER) || _MSC_VER < 1400
+static int dirent_mbstowcs_s(
+ size_t *pReturnValue, wchar_t *wcstr,
+ size_t sizeInWords, const char *mbstr, size_t count)
+{
+ /* Older Visual Studio or non-Microsoft compiler */
+ size_t n = mbstowcs(wcstr, mbstr, sizeInWords);
+ if (wcstr && n >= count)
+ return /*error*/ 1;
+
+ /* Zero-terminate output buffer */
+ if (wcstr && sizeInWords) {
+ if (n >= sizeInWords)
+ n = sizeInWords - 1;
+ wcstr[n] = 0;
+ }
+
+ /* Length of multi-byte string with zero terminator */
+ if (pReturnValue) {
+ *pReturnValue = n + 1;
+ }
+
+ /* Success */
+ return 0;
+}
+#endif
+
+/* Convert wide-character string to multi-byte string */
+#if !defined(_MSC_VER) || _MSC_VER < 1400
+static int dirent_wcstombs_s(
+ size_t *pReturnValue, char *mbstr,
+ size_t sizeInBytes, const wchar_t *wcstr, size_t count)
+{
+ /* Older Visual Studio or non-Microsoft compiler */
+ size_t n = wcstombs(mbstr, wcstr, sizeInBytes);
+ if (mbstr && n >= count)
+ return /*error*/1;
+
+ /* Zero-terminate output buffer */
+ if (mbstr && sizeInBytes) {
+ if (n >= sizeInBytes) {
+ n = sizeInBytes - 1;
+ }
+ mbstr[n] = '\0';
+ }
+
+ /* Length of resulting multi-bytes string WITH zero-terminator */
+ if (pReturnValue) {
+ *pReturnValue = n + 1;
+ }
+
+ /* Success */
+ return 0;
+}
+#endif
+
+/* Set errno variable */
+#if !defined(_MSC_VER) || _MSC_VER < 1400
+static void dirent_set_errno(int error)
+{
+ /* Non-Microsoft compiler or older Microsoft compiler */
+ errno = error;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*DIRENT_H*/
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/1/dir/readme.txt b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/1/dir/readme.txt
new file mode 100644
index 00000000..e59af2f4
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/1/dir/readme.txt
@@ -0,0 +1,3 @@
+This file ensures that the directory dir will be created accordingly when
+you unzip dirent to your computer. The directory itself is needed by the
+test program t-dirent.
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/1/file b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/1/file
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/2/Testfile-1.2.3.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/2/Testfile-1.2.3.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/2/file.txt b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/2/file.txt
new file mode 100644
index 00000000..d32e0045
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/2/file.txt
@@ -0,0 +1 @@
+This dummy file is needed by the test program t-dirent.
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/3zero.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/3zero.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/666.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/666.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/Qwerty-my-aunt.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/Qwerty-my-aunt.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/README.txt b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/README.txt
new file mode 100644
index 00000000..a07591cc
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/README.txt
@@ -0,0 +1,2 @@
+This directory contains some random files for the t-scandir test program. The
+files are empty and only the file names matter.
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/aaa.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/aaa.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/dirent.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/dirent.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/empty.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/empty.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/sane-1.12.0.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/sane-1.12.0.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/sane-1.2.30.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/sane-1.2.30.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/sane-1.2.4.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/sane-1.2.4.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/zebra.dat b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/3/zebra.dat
new file mode 100644
index 00000000..e69de29b
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-compile.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-compile.c
new file mode 100644
index 00000000..8eddb8e9
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-compile.c
@@ -0,0 +1,45 @@
+/*
+ * Test program to make sure that dirent compiles cleanly with winsock.
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#include
+#ifdef WIN32
+# include
+# include
+#endif
+#include
+#include
+#include
+
+int main(int argc, char *argv[])
+{
+ struct dirent *dirp = NULL;
+
+ (void) argc;
+ (void) argv;
+
+#ifdef _DIRENT_HAVE_D_TYPE
+ printf("Has d_type\n");
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ printf("Has d_namlen\n");
+#endif
+#ifdef _D_EXACT_NAMLEN
+ printf("Has _D_EXACT_NAMLEN\n");
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ printf("Has _D_ALLOC_NAMLEN\n");
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ printf("Has _D_ALLOC_NAMLEN\n");
+#endif
+ printf("Length of d_name with terminator: %d\n",
+ (int) sizeof(dirp->d_name));
+
+ printf("OK\n");
+ return EXIT_SUCCESS;
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-cplusplus.cpp b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-cplusplus.cpp
new file mode 100644
index 00000000..0f80a8c6
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-cplusplus.cpp
@@ -0,0 +1,151 @@
+/*
+ * Test program to make sure that dirent compiles cleanly with C++
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#include
+#include
+#include
+#include
+using namespace std;
+
+/* Filter and sort functions */
+static int only_readme(const struct dirent *entry);
+static void test_retrieval(void);
+static void test_scan(void);
+
+int main(int argc, char *argv[])
+{
+ (void) argc;
+ (void) argv;
+
+ test_retrieval();
+ test_scan();
+
+ cout << "OK" << endl;
+ return EXIT_SUCCESS;
+}
+
+/* Test basic directory retrieval */
+static void test_retrieval(void)
+{
+ /* Open directory */
+ DIR *dir = opendir("tests/1");
+ if (dir == NULL) {
+ cerr << "Directory tests/1 not found" << endl;
+ abort();
+ }
+
+ /* Read directory entries */
+ struct dirent *ent;
+ int found = 0;
+ while ((ent = readdir(dir)) != NULL) {
+ /* Check each file */
+ if (strcmp(ent->d_name, ".") == 0) {
+ /* Directory itself */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(ent->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(ent->d_namlen == 1);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(ent) == 1);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(ent) > 1);
+#endif
+ found += 1;
+ } else if (strcmp(ent->d_name, "..") == 0) {
+ /* Parent directory */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(ent->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(ent->d_namlen == 2);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(ent) == 2);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(ent) > 2);
+#endif
+ found += 2;
+ } else if (strcmp(ent->d_name, "file") == 0) {
+ /* Regular file */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(ent->d_type == DT_REG);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(ent->d_namlen == 4);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(ent) == 4);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(ent) > 4);
+#endif
+ found += 4;
+ } else if (strcmp(ent->d_name, "dir") == 0) {
+ /* Just a directory */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(ent->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(ent->d_namlen == 3);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(ent) == 3);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(ent) > 3);
+#endif
+ found += 8;
+ } else {
+ /* Other file */
+ cerr << "Unexpected file " << ent->d_name << endl;
+ abort();
+ }
+ }
+
+ /* Make sure that all files were found */
+ assert(found == 0xf);
+
+ closedir(dir);
+}
+
+/* Text basic scan with simple filter function */
+static void test_scan(void)
+{
+ struct dirent **files;
+
+ /* Read directory entries */
+ int n = scandir("tests/3", &files, only_readme, alphasort);
+ assert(n == 1);
+
+ /* Make sure that the filter works */
+ assert(strcmp(files[0]->d_name, "README.txt") == 0);
+
+ /* Release file names */
+ for (int i = 0; i < n; i++) {
+ free(files[i]);
+ }
+ free(files);
+}
+
+/* Only pass README.txt file */
+static int only_readme(const struct dirent *entry)
+{
+ int pass;
+
+ if (strcmp (entry->d_name, "README.txt") == 0) {
+ pass = 1;
+ } else {
+ pass = 0;
+ }
+
+ return pass;
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-dirent.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-dirent.c
new file mode 100644
index 00000000..9b2118d6
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-dirent.c
@@ -0,0 +1,597 @@
+/*
+ * A test program to make sure that dirent works correctly.
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#include
+#include
+#include
+#ifdef _MSC_VER
+# include
+# define chdir(x) _chdir(x)
+#else
+# include
+#endif
+#include
+#include
+#include
+
+#undef NDEBUG
+#include
+
+static void test_macros(void);
+static void test_retrieval(void);
+static void test_nonexistent(void);
+static void test_isfile(void);
+static void test_zero(void);
+static void test_rewind(void);
+static void test_chdir(void);
+static void test_filename(void);
+static void test_readdir(void);
+static void test_wreaddir(void);
+
+int main(int argc, char *argv[])
+{
+ (void) argc;
+ (void) argv;
+
+ /* Execute tests */
+ test_macros();
+ test_retrieval();
+ test_nonexistent();
+ test_isfile();
+ test_zero();
+ test_rewind();
+ test_chdir();
+ test_filename();
+ test_readdir();
+ test_wreaddir();
+
+ printf("OK\n");
+ return EXIT_SUCCESS;
+}
+
+/* Test file type macros */
+static void test_macros(void)
+{
+ assert(DTTOIF(DT_REG) == S_IFREG);
+ assert(DTTOIF(DT_DIR) == S_IFDIR);
+ assert(DTTOIF(DT_FIFO) == S_IFIFO);
+ assert(DTTOIF(DT_SOCK) == S_IFSOCK);
+ assert(DTTOIF(DT_CHR) == S_IFCHR);
+ assert(DTTOIF(DT_BLK) == S_IFBLK);
+
+ assert(IFTODT(S_IFREG) == DT_REG);
+ assert(IFTODT(S_IFDIR) == DT_DIR);
+ assert(IFTODT(S_IFIFO) == DT_FIFO);
+ assert(IFTODT(S_IFSOCK) == DT_SOCK);
+ assert(IFTODT(S_IFCHR) == DT_CHR);
+ assert(IFTODT(S_IFBLK) == DT_BLK);
+}
+
+/* Test basic directory retrieval */
+static void test_retrieval(void)
+{
+ /* Open directory */
+ DIR *dir = opendir("tests/1");
+ if (dir == NULL) {
+ fprintf(stderr, "Directory tests/1 not found\n");
+ abort();
+ }
+
+ /* Read entries */
+ struct dirent *ent;
+ int found = 0;
+ while ((ent = readdir(dir)) != NULL) {
+ /* Check each file */
+ if (strcmp(ent->d_name, ".") == 0) {
+ /* Directory itself */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(ent->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(ent->d_namlen == 1);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(ent) == 1);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(ent) > 1);
+#endif
+ found += 1;
+ } else if (strcmp(ent->d_name, "..") == 0) {
+ /* Parent directory */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(ent->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(ent->d_namlen == 2);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(ent) == 2);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(ent) > 2);
+#endif
+ found += 2;
+ } else if (strcmp(ent->d_name, "file") == 0) {
+ /* Regular file */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(ent->d_type == DT_REG);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(ent->d_namlen == 4);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(ent) == 4);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(ent) > 4);
+#endif
+ found += 4;
+ } else if (strcmp(ent->d_name, "dir") == 0) {
+ /* Just a directory */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(ent->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(ent->d_namlen == 3);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(ent) == 3);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(ent) > 3);
+#endif
+ found += 8;
+ } else {
+ /* Other file */
+ fprintf(stderr, "Unexpected file %s\n", ent->d_name);
+ abort();
+ }
+ }
+
+ /* Make sure that all files were found */
+ assert(found == 0xf);
+
+ closedir(dir);
+}
+
+/* Function opendir() fails if directory doesn't exist */
+static void test_nonexistent(void)
+{
+ DIR *dir = opendir("tests/invalid");
+ assert(dir == NULL);
+ assert(errno == ENOENT);
+}
+
+/* Function opendir() fails if pathname is really a file */
+static void test_isfile(void)
+{
+ DIR *dir = opendir("tests/1/file");
+ assert(dir == NULL);
+ assert(errno == ENOTDIR);
+}
+
+/* Function opendir() fails if pathname is a zero-length string */
+static void test_zero(void)
+{
+ DIR *dir = opendir("");
+ assert(dir == NULL);
+ assert(errno == ENOENT);
+}
+
+/* Test rewind of directory stream */
+static void test_rewind(void)
+{
+ /* Open directory */
+ DIR *dir = opendir("tests/1");
+ assert(dir != NULL);
+
+ /* Read entries */
+ int found = 0;
+ struct dirent *ent;
+ while ((ent = readdir(dir)) != NULL) {
+ /* Check each file */
+ if (strcmp(ent->d_name, ".") == 0) {
+ /* Directory itself */
+ found += 1;
+ } else if (strcmp(ent->d_name, "..") == 0) {
+ /* Parent directory */
+ found += 2;
+ } else if (strcmp(ent->d_name, "file") == 0) {
+ /* Regular file */
+ found += 4;
+ } else if (strcmp(ent->d_name, "dir") == 0) {
+ /* Just a directory */
+ found += 8;
+ } else {
+ /* Other file */
+ fprintf(stderr, "Unexpected file %s\n", ent->d_name);
+ abort();
+ }
+ }
+
+ /* Make sure that all files were found */
+ assert(found == 0xf);
+
+ /* Rewind stream and read entries again */
+ rewinddir(dir);
+ found = 0;
+
+ /* Read entries */
+ while ((ent = readdir(dir)) != NULL) {
+ /* Check each file */
+ if (strcmp(ent->d_name, ".") == 0) {
+ /* Directory itself */
+ found += 1;
+ } else if (strcmp(ent->d_name, "..") == 0) {
+ /* Parent directory */
+ found += 2;
+ } else if (strcmp(ent->d_name, "file") == 0) {
+ /* Regular file */
+ found += 4;
+ } else if (strcmp(ent->d_name, "dir") == 0) {
+ /* Just a directory */
+ found += 8;
+ } else {
+ /* Other file */
+ fprintf(stderr, "Unexpected file %s\n", ent->d_name);
+ abort();
+ }
+ }
+
+ /* Make sure that all files were found */
+ assert(found == 0xf);
+
+ closedir(dir);
+}
+
+/* Test rewind with intervening change of working directory */
+static void test_chdir(void)
+{
+ /* Open directory */
+ DIR *dir = opendir("tests/1");
+ assert(dir != NULL);
+
+ /* Read entries */
+ struct dirent *ent;
+ int found = 0;
+ while ((ent = readdir(dir)) != NULL) {
+ /* Check each file */
+ if (strcmp(ent->d_name, ".") == 0) {
+ /* Directory itself */
+ found += 1;
+ } else if (strcmp(ent->d_name, "..") == 0) {
+ /* Parent directory */
+ found += 2;
+ } else if (strcmp(ent->d_name, "file") == 0) {
+ /* Regular file */
+ found += 4;
+ } else if (strcmp(ent->d_name, "dir") == 0) {
+ /* Just a directory */
+ found += 8;
+ } else {
+ /* Other file */
+ fprintf(stderr, "Unexpected file %s\n", ent->d_name);
+ abort();
+ }
+
+ }
+
+ /* Make sure that all files were found */
+ assert(found == 0xf);
+
+ /* Change working directory */
+ int errorcode = chdir("tests");
+ assert(errorcode == 0);
+
+ /* Rewind stream and read entries again */
+ rewinddir(dir);
+ found = 0;
+
+ /* Read entries */
+ while ((ent = readdir(dir)) != NULL) {
+ /* Check each file */
+ if (strcmp(ent->d_name, ".") == 0) {
+ /* Directory itself */
+ found += 1;
+ } else if (strcmp(ent->d_name, "..") == 0) {
+ /* Parent directory */
+ found += 2;
+ } else if (strcmp(ent->d_name, "file") == 0) {
+ /* Regular file */
+ found += 4;
+ } else if (strcmp(ent->d_name, "dir") == 0) {
+ /* Just a directory */
+ found += 8;
+ } else {
+ /* Other file */
+ fprintf(stderr, "Unexpected file %s\n", ent->d_name);
+ abort();
+ }
+ }
+
+ /* Make sure that all files were found */
+ assert(found == 0xf);
+
+ /* Restore working directory */
+ errorcode = chdir("..");
+ assert(errorcode == 0);
+
+ closedir(dir);
+}
+
+/* Test long file name */
+static void test_filename(void)
+{
+ /* Open directory */
+ DIR *dir = opendir("tests/2");
+ if (dir == NULL) {
+ fprintf(stderr, "Directory tests/2 not found\n");
+ abort();
+ }
+
+ /* Read entries */
+ struct dirent *ent;
+ int found = 0;
+ while ((ent = readdir(dir)) != NULL) {
+ /* Check each file */
+ if (strcmp(ent->d_name, ".") == 0) {
+ /* Directory itself */
+ found += 1;
+ } else if (strcmp(ent->d_name, "..") == 0) {
+ /* Parent directory */
+ found += 2;
+ } else if (strcmp(ent->d_name, "file.txt") == 0) {
+ /* Regular 8+3 filename */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(ent->d_type == DT_REG);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(ent->d_namlen == 8);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(ent) == 8);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(ent) > 8);
+#endif
+ found += 4;
+ } else if (strcmp(ent->d_name, "Testfile-1.2.3.dat") == 0) {
+ /* Long file name with multiple dots */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(ent->d_type == DT_REG);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(ent->d_namlen == 18);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(ent) == 18);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(ent) > 18);
+#endif
+ found += 8;
+ } else {
+ /* Other file */
+ fprintf(stderr, "Unexpected file %s\n", ent->d_name);
+ abort();
+ }
+ }
+
+ /* Make sure that all files were found */
+ assert(found == 0xf);
+
+ closedir(dir);
+}
+
+/* Test basic directory retrieval with readdir_r */
+static void test_readdir(void)
+{
+ /* Open directory */
+ DIR *dir = opendir("tests/1");
+ if (dir == NULL) {
+ fprintf(stderr, "Directory tests/1 not found\n");
+ abort();
+ }
+
+ /* Read entries to table */
+ struct dirent ent[10];
+ struct dirent *entry;
+ size_t i = 0;
+ size_t n = 0;
+ while (readdir_r(dir, &ent[n], &entry) == /*OK*/0 && entry != 0) {
+ n++;
+ assert(n <= 4);
+ }
+
+ /* Make sure that we got all the files from directory */
+ assert(n == 4);
+
+ /* Check entries in memory */
+ int found = 0;
+ for (i = 0; i < 4; i++) {
+ entry = &ent[i];
+
+ /* Check each file */
+ if (strcmp(entry->d_name, ".") == 0) {
+ /* Directory itself */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(entry->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(entry->d_namlen == 1);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(entry) == 1);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(entry) > 1);
+#endif
+ found += 1;
+ } else if (strcmp(entry->d_name, "..") == 0) {
+ /* Parent directory */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(entry->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(entry->d_namlen == 2);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(entry) == 2);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(entry) > 2);
+#endif
+ found += 2;
+ } else if (strcmp(entry->d_name, "file") == 0) {
+ /* Regular file */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(entry->d_type == DT_REG);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(entry->d_namlen == 4);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(entry) == 4);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(entry) > 4);
+#endif
+ found += 4;
+ } else if (strcmp(entry->d_name, "dir") == 0) {
+ /* Just a directory */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(entry->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(entry->d_namlen == 3);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(entry) == 3);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(entry) > 3);
+#endif
+ found += 8;
+ } else {
+ /* Other file */
+ fprintf(stderr, "Unexpected file %s\n", entry->d_name);
+ abort();
+ }
+
+ }
+
+ /* Make sure that all files were found */
+ assert(found == 0xf);
+
+ closedir(dir);
+}
+
+/* Basic directory retrieval with _wreaddir_r */
+static void test_wreaddir(void)
+{
+#ifdef WIN32
+ /* Open directory */
+ _WDIR *dir = _wopendir(L"tests/1");
+ if (dir == NULL) {
+ fprintf(stderr, "Directory tests/1 not found\n");
+ abort();
+ }
+
+ /* Read entries to table */
+ struct _wdirent ent[10];
+ struct _wdirent *entry;
+ size_t i = 0;
+ size_t n = 0;
+ while (_wreaddir_r(dir, &ent[n], &entry) == /*OK*/0 && entry != 0) {
+ n++;
+ assert(n <= 4);
+ }
+
+ /* Make sure that we got all the files from directory */
+ assert(n == 4);
+
+ /* Check entries in memory */
+ int found = 0;
+ for (i = 0; i < 4; i++) {
+ entry = &ent[i];
+
+ /* Check each file */
+ if (wcscmp(entry->d_name, L".") == 0) {
+ /* Directory itself */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(entry->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(entry->d_namlen == 1);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(entry) == 1);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(entry) > 1);
+#endif
+ found += 1;
+ } else if (wcscmp(entry->d_name, L"..") == 0) {
+ /* Parent directory */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(entry->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(entry->d_namlen == 2);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(entry) == 2);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(entry) > 2);
+#endif
+ found += 2;
+ } else if (wcscmp(entry->d_name, L"file") == 0) {
+ /* Regular file */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(entry->d_type == DT_REG);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(entry->d_namlen == 4);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(entry) == 4);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(entry) > 4);
+#endif
+ found += 4;
+ } else if (wcscmp(entry->d_name, L"dir") == 0) {
+ /* Just a directory */
+#ifdef _DIRENT_HAVE_D_TYPE
+ assert(entry->d_type == DT_DIR);
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ assert(entry->d_namlen == 3);
+#endif
+#ifdef _D_EXACT_NAMLEN
+ assert(_D_EXACT_NAMLEN(entry) == 3);
+#endif
+#ifdef _D_ALLOC_NAMLEN
+ assert(_D_ALLOC_NAMLEN(entry) > 3);
+#endif
+ found += 8;
+ } else {
+ /* Other file */
+ fprintf(stderr, "Unexpected file\n");
+ abort();
+ }
+ }
+
+ /* Make sure that all files were found */
+ assert(found == 0xf);
+
+ _wclosedir(dir);
+#endif
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-scandir.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-scandir.c
new file mode 100644
index 00000000..5b52b8d7
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-scandir.c
@@ -0,0 +1,290 @@
+/*
+ * Make sure that scandir function works OK.
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+
+/* Silence warning about fopen being insecure (MS Visual Studio) */
+#define _CRT_SECURE_NO_WARNINGS
+
+/* Include prototype for versionsort (Linux) */
+#define _GNU_SOURCE
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#undef NDEBUG
+#include
+
+
+/* Filter and sort functions */
+static int only_readme(const struct dirent *entry);
+static int no_directories(const struct dirent *entry);
+static int reverse_alpha(const struct dirent **a, const struct dirent **b);
+
+
+int main(int argc, char *argv[])
+{
+ struct dirent **files;
+ int i;
+ int n;
+
+ (void) argc;
+ (void) argv;
+
+ /* Initialize random number generator */
+ srand((unsigned) time(NULL));
+
+ /* Basic scan with simple filter function */
+ {
+ /* Read directory entries */
+ n = scandir("tests/3", &files, only_readme, alphasort);
+ assert(n == 1);
+
+ /* Make sure that the filter works */
+ assert(strcmp(files[0]->d_name, "README.txt") == 0);
+
+ /* Release file names */
+ for (i = 0; i < n; i++) {
+ free(files[i]);
+ }
+ free(files);
+ }
+
+ /* Basic scan with default sorting function */
+ {
+ /* Read directory entries in alphabetic order */
+ n = scandir("tests/3", &files, NULL, alphasort);
+ assert(n == 13);
+
+ /* Make sure that we got all the names in the proper order */
+ assert(strcmp(files[0]->d_name, ".") == 0);
+ assert(strcmp(files[1]->d_name, "..") == 0);
+ assert(strcmp(files[2]->d_name, "3zero.dat") == 0);
+ assert(strcmp(files[3]->d_name, "666.dat") == 0);
+ assert(strcmp(files[4]->d_name, "Qwerty-my-aunt.dat") == 0);
+ assert(strcmp(files[5]->d_name, "README.txt") == 0);
+ assert(strcmp(files[6]->d_name, "aaa.dat") == 0);
+ assert(strcmp(files[7]->d_name, "dirent.dat") == 0);
+ assert(strcmp(files[8]->d_name, "empty.dat") == 0);
+ assert(strcmp(files[9]->d_name, "sane-1.12.0.dat") == 0);
+ assert(strcmp(files[10]->d_name, "sane-1.2.30.dat") == 0);
+ assert(strcmp(files[11]->d_name, "sane-1.2.4.dat") == 0);
+ assert(strcmp(files[12]->d_name, "zebra.dat") == 0);
+
+ /* Release file names */
+ for (i = 0; i < n; i++) {
+ free(files[i]);
+ }
+ free(files);
+ }
+
+ /* Custom filter AND sort function */
+ {
+ /* Read directory entries in alphabetic order */
+ n = scandir("tests/3", &files, no_directories, reverse_alpha);
+ assert(n == 11);
+
+ /* Make sure that we got file names in the reverse order */
+ assert(strcmp(files[0]->d_name, "zebra.dat") == 0);
+ assert(strcmp(files[1]->d_name, "sane-1.2.4.dat") == 0);
+ assert(strcmp(files[2]->d_name, "sane-1.2.30.dat") == 0);
+ assert(strcmp(files[3]->d_name, "sane-1.12.0.dat") == 0);
+ assert(strcmp(files[4]->d_name, "empty.dat") == 0);
+ assert(strcmp(files[5]->d_name, "dirent.dat") == 0);
+ assert(strcmp(files[6]->d_name, "aaa.dat") == 0);
+ assert(strcmp(files[7]->d_name, "README.txt") == 0);
+ assert(strcmp(files[8]->d_name, "Qwerty-my-aunt.dat") == 0);
+ assert(strcmp(files[9]->d_name, "666.dat") == 0);
+ assert(strcmp(files[10]->d_name, "3zero.dat") == 0);
+
+ /* Release file names */
+ for (i = 0; i < n; i++) {
+ free(files[i]);
+ }
+ free(files);
+ }
+
+ /* Trying to read from non-existent directory leads to an error */
+ {
+ files = NULL;
+ n = scandir("tests/invalid", &files, NULL, alphasort);
+ assert(n == -1);
+ assert(files == NULL);
+ assert(errno == ENOENT);
+ }
+
+ /* Trying to open file as a directory produces ENOTDIR error */
+ {
+ files = NULL;
+ n = scandir("tests/3/666.dat", &files, NULL, alphasort);
+ assert(n == -1);
+ assert(files == NULL);
+ assert(errno == ENOTDIR);
+ }
+
+ /* Sort files using versionsort() */
+ {
+ files = NULL;
+ n = scandir("tests/3", &files, no_directories, versionsort);
+ assert(n == 11);
+
+ /*
+ * Make sure that we got all the file names in the proper order:
+ * 1.2.4 < 1.2.30 < 1.12.0
+ */
+ assert(strcmp(files[0]->d_name, "3zero.dat") == 0);
+ assert(strcmp(files[1]->d_name, "666.dat") == 0);
+ assert(strcmp(files[2]->d_name, "Qwerty-my-aunt.dat") == 0);
+ assert(strcmp(files[3]->d_name, "README.txt") == 0);
+ assert(strcmp(files[4]->d_name, "aaa.dat") == 0);
+ assert(strcmp(files[5]->d_name, "dirent.dat") == 0);
+ assert(strcmp(files[6]->d_name, "empty.dat") == 0);
+ assert(strcmp(files[7]->d_name, "sane-1.2.4.dat") == 0);
+ assert(strcmp(files[8]->d_name, "sane-1.2.30.dat") == 0);
+ assert(strcmp(files[9]->d_name, "sane-1.12.0.dat") == 0);
+ assert(strcmp(files[10]->d_name, "zebra.dat") == 0);
+
+ /* Release file names */
+ for (i = 0; i < n; i++) {
+ free(files[i]);
+ }
+ free(files);
+ }
+
+ /* Scan large directory */
+ {
+ char dirname[PATH_MAX+1];
+ int i;
+ int ok;
+
+ /* Copy name of temporary directory to variable dirname */
+#ifdef WIN32
+ i = GetTempPathA(PATH_MAX, dirname);
+ assert(i > 0);
+#else
+ strcpy(dirname, "/tmp/");
+ i = strlen(dirname);
+#endif
+
+ /* Append random characters to dirname */
+ for (int j = 0; j < 10; j++) {
+ char c;
+
+ /* Generate random character */
+ c = "abcdefghijklmnopqrstuvwxyz"[rand() % 26];
+
+ /* Append character to dirname */
+ assert(i < PATH_MAX);
+ dirname[i++] = c;
+ }
+
+ /* Terminate directory name */
+ assert(i < PATH_MAX);
+ dirname[i] = '\0';
+
+ /* Create directory */
+#ifdef WIN32
+ ok = CreateDirectoryA(dirname, NULL);
+ assert(ok);
+#else
+ ok = mkdir(dirname, 0700);
+ assert(ok == /*success*/0);
+#endif
+
+ /* Create one thousand files */
+ assert(i + 5 < PATH_MAX);
+ for (int j = 0; j < 1000; j++) {
+ FILE *fp;
+
+ /* Construct file name */
+ dirname[i] = '/';
+ dirname[i+1] = 'z';
+ dirname[i+2] = '0' + ((j / 100) % 10);
+ dirname[i+3] = '0' + ((j / 10) % 10);
+ dirname[i+4] = '0' + (j % 10);
+ dirname[i+5] = '\0';
+
+ /* Create file */
+ fp = fopen(dirname, "w");
+ assert(fp != NULL);
+ fclose(fp);
+
+ }
+
+ /* Cut out the file name part */
+ dirname[i] = '\0';
+
+ /* Scan directory */
+ n = scandir(dirname, &files, no_directories, alphasort);
+ assert(n == 1000);
+
+ /* Make sure that all 1000 files are read back */
+ for (int j = 0; j < n; j++) {
+ char match[100];
+
+ /* Construct file name */
+ match[0] = 'z';
+ match[1] = '0' + ((j / 100) % 10);
+ match[2] = '0' + ((j / 10) % 10);
+ match[3] = '0' + (j % 10);
+ match[4] = '\0';
+
+ /* Make sure that file name matches that on the disk */
+ assert(strcmp(files[j]->d_name, match) == 0);
+
+ }
+
+ /* Release file names */
+ for (int j = 0; j < n; j++) {
+ free(files[j]);
+ }
+ free(files);
+ }
+
+ printf("OK\n");
+ return EXIT_SUCCESS;
+}
+
+/* Only pass README.txt file */
+static int only_readme(const struct dirent *entry)
+{
+ int pass;
+
+ if (strcmp(entry->d_name, "README.txt") == 0) {
+ pass = 1;
+ } else {
+ pass = 0;
+ }
+
+ return pass;
+}
+
+/* Filter out directories */
+static int no_directories(const struct dirent *entry)
+{
+ int pass;
+
+ if (entry->d_type != DT_DIR) {
+ pass = 1;
+ } else {
+ pass = 0;
+ }
+
+ return pass;
+}
+
+/* Sort in reverse direction */
+static int reverse_alpha(const struct dirent **a, const struct dirent **b)
+{
+ return strcoll((*b)->d_name, (*a)->d_name);
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-strverscmp.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-strverscmp.c
new file mode 100644
index 00000000..26e905bf
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-strverscmp.c
@@ -0,0 +1,206 @@
+/*
+ * Test program to make sure that strverscmp works correctly
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+
+/* Include prototype for strverscmp */
+#define _GNU_SOURCE
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+int
+main(
+ int argc, char *argv[])
+{
+ (void) argc;
+ (void) argv;
+
+ /* Strings without digits are compared as in strcmp() */
+ assert(strverscmp("", "") == 0);
+ assert(strverscmp("abc", "abc") == 0);
+ assert(strverscmp("a", "b") < 0);
+ assert(strverscmp("b", "a") > 0);
+
+ /* Shorter string is smaller, other things being equal */
+ assert(strverscmp("a", "aa") < 0);
+ assert(strverscmp("aa", "a") > 0);
+ assert(strverscmp("abcdef", "abcdefg") < 0);
+ assert(strverscmp("abcdefg", "abcdef") > 0);
+
+ /* Integers with equal length are compared as in strcmp() */
+ assert(strverscmp("0", "0") == 0);
+ assert(strverscmp("000", "000") == 0);
+ assert(strverscmp("1", "2") < 0);
+ assert(strverscmp("2", "1") > 0);
+ assert(strverscmp("001", "100") < 0);
+ assert(strverscmp("100", "001") > 0);
+ assert(strverscmp("2020-07-01", "2020-07-02") < 0);
+ assert(strverscmp("2020-07-02", "2020-07-01") > 0);
+ assert(strverscmp("jan999", "jan999") == 0);
+
+ /* Integers of different length are compared as numbers */
+ assert(strverscmp("jan9", "jan10") < 0);
+ assert(strverscmp("jan10", "jan9") > 0);
+ assert(strverscmp("999", "1000") < 0);
+ assert(strverscmp("1000", "999") > 0);
+ assert(strverscmp("t12-1000", "t12-9999") < 0);
+ assert(strverscmp("t12-9999", "t12-1000") > 0);
+ assert(strverscmp("1000", "10001") < 0);
+ assert(strverscmp("10001", "1000") > 0);
+ assert(strverscmp("1000!", "10001") < 0);
+ assert(strverscmp("10001", "1000!") > 0);
+ assert(strverscmp("1000Z", "10001") < 0);
+ assert(strverscmp("10001", "1000Z") > 0);
+
+ /* If numbers starts with zero, then longer number is smaller */
+ assert(strverscmp("00", "0") < 0);
+ assert(strverscmp("0", "00") > 0);
+ assert(strverscmp("a000", "a00") < 0);
+ assert(strverscmp("a00", "a000") > 0);
+ assert(strverscmp("0000", "000") < 0);
+ assert(strverscmp("000", "0000") > 0);
+ assert(strverscmp("0000", "000!") < 0);
+ assert(strverscmp("000!", "0000") > 0);
+ assert(strverscmp("0000", "000Z") < 0);
+ assert(strverscmp("000Z", "0000") > 0);
+ assert(strverscmp("0000", "000Z") < 0);
+ assert(strverscmp("000Z", "0000") > 0);
+ assert(strverscmp("1.01", "1.0") < 0);
+ assert(strverscmp("1.0", "1.01") > 0);
+ assert(strverscmp("1.01", "1.0!") < 0);
+ assert(strverscmp("1.0!", "1.01") > 0);
+ assert(strverscmp("1.01", "1.0~") < 0);
+ assert(strverscmp("1.0~", "1.01") > 0);
+
+ /* Number having more leading zeros is considered smaller */
+ assert(strverscmp("item-0001", "item-001") < 0);
+ assert(strverscmp("item-001", "item-0001") > 0);
+ assert(strverscmp("item-001", "item-01") < 0);
+ assert(strverscmp("item-01", "item-001") > 0);
+ assert(strverscmp(".0001000", ".001") < 0);
+ assert(strverscmp(".001", ".0001000") > 0);
+ assert(strverscmp(".0001000", ".01") < 0);
+ assert(strverscmp(".01", ".0001000") > 0);
+ assert(strverscmp(".0001000", ".1") < 0);
+ assert(strverscmp(".1", ".0001000") > 0);
+ assert(strverscmp("1.0002", "1.0010000") < 0);
+ assert(strverscmp("1.0010000", "1.0002") > 0);
+
+ /* Number starting with zero is smaller than any number */
+ assert(strverscmp("item-009", "item-1") < 0);
+ assert(strverscmp("item-1", "item-009") > 0);
+ assert(strverscmp("item-099", "item-2") < 0);
+ assert(strverscmp("item-2", "item-099") > 0);
+
+ /* Number vs alphabetical comparison */
+ assert(strverscmp("1.001", "1.00!") < 0);
+ assert(strverscmp("1.00!", "1.001") > 0);
+ assert(strverscmp("1.001", "1.00x") < 0);
+ assert(strverscmp("1.00x", "1.001") > 0);
+ assert(strverscmp("1", "x") < 0);
+ assert(strverscmp("x", "1") > 0);
+ assert(strverscmp("1", "!") > 0);
+ assert(strverscmp("!", "1") < 0);
+
+ /* Handling the end of string */
+ assert(strverscmp("01", "011") < 0);
+ assert(strverscmp("011", "01") > 0);
+ assert(strverscmp("0100", "01000") < 0);
+ assert(strverscmp("01000", "0100") > 0);
+ assert(strverscmp("1", "1!") < 0);
+ assert(strverscmp("1!", "1") > 0);
+ assert(strverscmp("1", "1z") < 0);
+ assert(strverscmp("1z", "1") > 0);
+
+ /* Ordering 000 < 00 < 01 < 010 < 09 < 0 < 1 < 9 < 10 */
+ assert(strverscmp("000", "00") < 0);
+ assert(strverscmp("000", "01") < 0);
+ assert(strverscmp("000", "010") < 0);
+ assert(strverscmp("000", "09") < 0);
+ assert(strverscmp("000", "0") < 0);
+ assert(strverscmp("000", "1") < 0);
+ assert(strverscmp("000", "9") < 0);
+ assert(strverscmp("000", "10") < 0);
+
+ assert(strverscmp("00", "01") < 0);
+ assert(strverscmp("00", "010") < 0);
+ assert(strverscmp("00", "09") < 0);
+ assert(strverscmp("00", "0") < 0);
+ assert(strverscmp("00", "1") < 0);
+ assert(strverscmp("00", "9") < 0);
+ assert(strverscmp("00", "10") < 0);
+
+ assert(strverscmp("01", "010") < 0);
+ assert(strverscmp("01", "09") < 0);
+ assert(strverscmp("01", "0") < 0);
+ assert(strverscmp("01", "1") < 0);
+ assert(strverscmp("01", "9") < 0);
+ assert(strverscmp("01", "10") < 0);
+
+ assert(strverscmp("010", "09") < 0);
+ assert(strverscmp("010", "0") < 0);
+ assert(strverscmp("010", "1") < 0);
+ assert(strverscmp("010", "9") < 0);
+ assert(strverscmp("010", "10") < 0);
+
+ assert(strverscmp("09", "0") < 0);
+ assert(strverscmp("09", "1") < 0);
+ assert(strverscmp("09", "9") < 0);
+ assert(strverscmp("09", "10") < 0);
+
+ assert(strverscmp("0", "1") < 0);
+ assert(strverscmp("0", "9") < 0);
+ assert(strverscmp("0", "10") < 0);
+
+ assert(strverscmp("1", "9") < 0);
+ assert(strverscmp("1", "10") < 0);
+
+ assert(strverscmp("9", "10") < 0);
+
+ /* Compare speed */
+ {
+#define LENGTH 100
+#define REPEAT 1000000
+ char a[LENGTH+1];
+ char b[LENGTH+1];
+ size_t i;
+ size_t j;
+ char letters[] = "01234567890123456789abdefghjkpqrtwxyz-/.";
+ size_t n = strlen(letters);
+
+ /* Repeat test */
+ for(i = 0; i < REPEAT; i++) {
+ int diff1;
+ int diff2;
+
+ /* Generate two random strings of LENGTH characters */
+ for(j = 0; j < LENGTH; j++) {
+ a[j] = letters[rand() % n];
+ b[j] = letters[rand() % n];
+ }
+ a[j] = '\0';
+ b[j] = '\0';
+
+ /* Compare strings in both directions */
+ diff1 = strverscmp(a, b);
+ diff2 = strverscmp(b, a);
+
+ /* Must give identical result in both directions */
+ assert((diff1 < 0 && diff2 > 0)
+ || (diff1 == 0 && diff2 == 0)
+ || (diff1 > 0 && diff2 < 0));
+ }
+ }
+
+ printf("OK\n");
+ return EXIT_SUCCESS;
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-unicode.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-unicode.c
new file mode 100644
index 00000000..76cdca50
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-unicode.c
@@ -0,0 +1,385 @@
+/*
+ * Test program to try unicode file names.
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+
+/* Silence warning about fopen being insecure */
+#define _CRT_SECURE_NO_WARNINGS
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#undef NDEBUG
+#include
+
+int main(int argc, char *argv[])
+{
+#ifdef WIN32
+ wchar_t wpath[MAX_PATH+1];
+ char path[MAX_PATH+1];
+ DWORD i, j, k, x;
+ BOOL ok;
+ HANDLE fh;
+ _WDIR *wdir;
+ struct _wdirent *wentry;
+ DIR *dir;
+ struct dirent *entry;
+ char buffer[100];
+ FILE *fp;
+ int counter = 0;
+
+
+ /* Initialize random number generator */
+ srand(((int) time(NULL)) * 257 + ((int) GetCurrentProcessId()));
+
+ /* Set current locale */
+ if (argc > 1) {
+ printf("Locale %s\n", argv[1]);
+ setlocale(LC_ALL, argv[1]);
+ } else {
+ setlocale(LC_ALL, "");
+ }
+
+
+ /****** CREATE FILE WITH UNICODE FILE NAME ******/
+
+ /* Get path to temporary directory (wide-character and ascii) */
+ i = GetTempPathW(MAX_PATH, wpath);
+ assert(i > 0);
+ j = GetTempPathA(MAX_PATH, path);
+ assert(j > 0);
+
+ /* Append random directory name */
+ for (k = 0; k < 10; k++) {
+ /* Generate random character */
+ char c = "abcdefghijklmnopqrstuvwxyz"[rand() % 26];
+
+ /* Append character to paths */
+ assert(i < MAX_PATH && j < MAX_PATH);
+ wpath[i++] = c;
+ path[j++] = c;
+ }
+
+ /* Terminate paths */
+ assert(i < MAX_PATH && j < MAX_PATH);
+ wpath[i] = '\0';
+ path[j] = '\0';
+
+ /* Remember the end of directory name */
+ k = i;
+
+ /* Create directory using unicode */
+ ok = CreateDirectoryW(wpath, NULL);
+ if (!ok) {
+ DWORD e = GetLastError();
+ wprintf(L"Cannot create directory %ls (code %u)\n", wpath, e);
+ abort();
+ }
+
+ /* Overwrite zero terminator with path separator */
+ assert(i < MAX_PATH && j < MAX_PATH);
+ wpath[i++] = '\\';
+
+ /* Append a few unicode characters */
+ assert(i < MAX_PATH);
+ wpath[i++] = 0x6d4b;
+ assert(i < MAX_PATH);
+ wpath[i++] = 0x8bd5;
+
+ /* Terminate string */
+ assert(i < MAX_PATH);
+ wpath[i] = '\0';
+
+ /* Create file with unicode */
+ fh = CreateFileW(
+ wpath,
+ /* Access */ GENERIC_READ | GENERIC_WRITE,
+ /* Share mode */ 0,
+ /* Security attributes */ NULL,
+ /* Creation disposition */ CREATE_NEW,
+ /* Attributes */ FILE_ATTRIBUTE_NORMAL,
+ /* Template files */ NULL
+ );
+ assert(fh != INVALID_HANDLE_VALUE);
+
+ /* Write some data to file */
+ ok = WriteFile(
+ /* File handle */ fh,
+ /* Pointer to data */ "hep\n",
+ /* Number of bytes to write */ 4,
+ /* Number of bytes written */ NULL,
+ /* Overlapped */ NULL
+ );
+ assert(ok);
+
+ /* Close file */
+ ok = CloseHandle(fh);
+ assert(ok);
+
+
+ /****** MAKE SURE THAT UNICODE FILE CAN BE READ BY _WREADDIR ******/
+
+ /* Zero terminate wide-character path and open directory stream */
+ wpath[k] = '\0';
+ wdir = _wopendir(wpath);
+ if (wdir == NULL) {
+ wprintf(L"Cannot open directory %ls\n", wpath);
+ abort();
+ }
+
+ /* Read through entries */
+ counter = 0;
+ while ((wentry = _wreaddir(wdir)) != NULL) {
+ /* Skip pseudo directories */
+ if (wcscmp(wentry->d_name, L".") == 0) {
+ continue;
+ }
+ if (wcscmp(wentry->d_name, L"..") == 0) {
+ continue;
+ }
+
+ /* Found a file */
+ counter++;
+ assert(wentry->d_type == DT_REG);
+
+ /* Append file name to path */
+ i = k;
+ assert(i < MAX_PATH);
+ wpath[i++] = '\\';
+ x = 0;
+ while (wentry->d_name[x] != '\0') {
+ assert(i < MAX_PATH);
+ wpath[i++] = wentry->d_name[x++];
+ }
+ assert(i < MAX_PATH);
+ wpath[i] = '\0';
+
+ /* Open file for read */
+ fh = CreateFileW(
+ wpath,
+ /* Access */ GENERIC_READ,
+ /* Share mode */ 0,
+ /* Security attributes */ NULL,
+ /* Creation disposition */ OPEN_EXISTING,
+ /* Attributes */ FILE_ATTRIBUTE_NORMAL,
+ /* Template files */ NULL
+ );
+ assert(fh != INVALID_HANDLE_VALUE);
+
+ /* Read data from file */
+ ok = ReadFile(
+ /* File handle */ fh,
+ /* Output buffer */ buffer,
+ /* Max number of bytes to read */ sizeof(buffer) - 1,
+ /* Number of bytes actually read */ &x,
+ /* Overlapped */ NULL
+ );
+ assert(ok);
+
+ /* Make sure that we got the file contents right */
+ assert(x == 4);
+ assert(buffer[0] == 'h');
+ assert(buffer[1] == 'e');
+ assert(buffer[2] == 'p');
+ assert(buffer[3] == '\n');
+
+ /* Close file */
+ ok = CloseHandle(fh);
+ assert(ok);
+ }
+ assert(counter == 1);
+
+ /* Close directory */
+ _wclosedir(wdir);
+
+
+ /****** MAKE SURE THAT UNICODE FILE NAME CAN BE READ BY READDIR *****/
+
+ /* Zero terminate ascii path and open directory stream */
+ k = j;
+ path[k] = '\0';
+ dir = opendir(path);
+ if (dir == NULL) {
+ fprintf(stderr, "Cannot open directory %s\n", path);
+ abort();
+ }
+
+ /* Read through entries */
+ counter = 0;
+ while ((entry = readdir(dir)) != NULL) {
+ /* Skip pseudo directories */
+ if (strcmp(entry->d_name, ".") == 0) {
+ continue;
+ }
+ if (strcmp(entry->d_name, "..") == 0) {
+ continue;
+ }
+
+ /* Found a file */
+ counter++;
+ assert(entry->d_type == DT_REG);
+
+ /* Append file name to path */
+ j = k;
+ assert(j < MAX_PATH);
+ path[j++] = '\\';
+ x = 0;
+ while (entry->d_name[x] != '\0') {
+ assert(j < MAX_PATH);
+ path[j++] = entry->d_name[x++];
+ }
+ assert(j < MAX_PATH);
+ path[j] = '\0';
+
+ /* Open file for read */
+ fp = fopen(path, "r");
+ if (!fp) {
+ fprintf(stderr, "Cannot open file %s\n", path);
+ abort();
+ }
+
+ /* Read data from file */
+ if (fgets(buffer, sizeof(buffer), fp) == NULL) {
+ fprintf(stderr, "Cannot read file %s\n", path);
+ abort();
+ }
+
+ /* Make sure that we got the file contents right */
+ assert(buffer[0] == 'h');
+ assert(buffer[1] == 'e');
+ assert(buffer[2] == 'p');
+ assert(buffer[3] == '\n');
+ assert(buffer[4] == '\0');
+
+ /* Close file */
+ fclose(fp);
+ }
+ assert(counter == 1);
+
+ /* Close directory */
+ closedir(dir);
+
+
+ /****** CREATE FILE WITH UTF-8 ******/
+
+ /* Append UTF-8 file name (åäö.txt) to path */
+ j = k;
+ path[j++] = '\\';
+ path[j++] = 0xc3;
+ path[j++] = 0xa5;
+ path[j++] = 0xc3;
+ path[j++] = 0xa4;
+ path[j++] = 0xc3;
+ path[j++] = 0xb6;
+ path[j++] = 0x2e;
+ path[j++] = 0x74;
+ path[j++] = 0x78;
+ path[j++] = 0x74;
+ assert(j < MAX_PATH);
+ path[j] = '\0';
+
+ /*
+ * Create file.
+ *
+ * Be ware that the code below creates a different file depending on
+ * the current locale! For example, if the current locale is
+ * english_us.65001, then the file name will be "åäö.txt" (7
+ * characters). However, if the current locale is english_us.1252,
+ * then the file name will be "ÃċÃĊö.txt" (10 characters).
+ */
+ printf("Creating %s\n", path);
+ fp = fopen(path, "w");
+ if (!fp) {
+ fprintf(stderr, "Cannot open file %s\n", path);
+ abort();
+ }
+ fputs("hep\n", fp);
+ fclose(fp);
+
+ /* Open directory again */
+ path[k] = '\0';
+ dir = opendir(path);
+ if (dir == NULL) {
+ fprintf(stderr, "Cannot open directory %s\n", path);
+ abort();
+ }
+
+ /* Read through entries */
+ counter = 0;
+ while ((entry = readdir(dir)) != NULL) {
+ /* Skip pseudo directories */
+ if (strcmp(entry->d_name, ".") == 0) {
+ continue;
+ }
+ if (strcmp(entry->d_name, "..") == 0) {
+ continue;
+ }
+
+ /* Found a file */
+ counter++;
+ assert(entry->d_type == DT_REG);
+
+ /* Append file name to path */
+ j = k;
+ assert(j < MAX_PATH);
+ path[j++] = '\\';
+ x = 0;
+ while (entry->d_name[x] != '\0') {
+ assert(j < MAX_PATH);
+ path[j++] = entry->d_name[x++];
+ }
+ assert(j < MAX_PATH);
+ path[j] = '\0';
+
+ /* Print file name for debugging */
+ printf("Opening \"%s\" hex ", path + k + 1);
+ x = 0;
+ while (entry->d_name[x] != '\0') {
+ printf("0x%02x ",
+ (unsigned) (entry->d_name[x++] & 0xff));
+ }
+ printf("\n");
+
+ /* Open file for read */
+ fp = fopen(path, "r");
+ if (!fp) {
+ fprintf(stderr, "Cannot open file %s\n", path);
+ abort();
+ }
+
+ /* Read data from file */
+ if (fgets(buffer, sizeof(buffer), fp) == NULL) {
+ fprintf(stderr, "Cannot read file %s\n", path);
+ abort();
+ }
+
+ /* Make sure that we got the file contents right */
+ assert(buffer[0] == 'h');
+ assert(buffer[1] == 'e');
+ assert(buffer[2] == 'p');
+ assert(buffer[3] == '\n');
+ assert(buffer[4] == '\0');
+
+ /* Close file */
+ fclose(fp);
+ }
+ assert(counter == 2);
+
+ /* Close directory */
+ closedir(dir);
+#else
+ /* Linux */
+ (void) argc;
+ (void) argv;
+#endif
+ return EXIT_SUCCESS;
+}
diff --git a/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-utf8.c b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-utf8.c
new file mode 100644
index 00000000..90abbbe0
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_FileManager/dirent-master/tests/t-utf8.c
@@ -0,0 +1,237 @@
+/*
+ * Test program to try UTF-8 file names.
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+
+/* Silence warning about fopen being insecure */
+#define _CRT_SECURE_NO_WARNINGS
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#undef NDEBUG
+#include
+
+int main(int argc, char *argv[])
+{
+#ifdef WIN32
+ /*
+ * Select UTF-8 locale. This will change the way how C runtime
+ * functions such as fopen() and mkdir() handle character strings.
+ * For more information, please see:
+ * https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale?view=msvc-160#utf-8-support
+ */
+ setlocale(LC_ALL, "LC_CTYPE=.utf8");
+
+ /* Initialize random number generator */
+ srand(((int) time(NULL)) * 257 + ((int) GetCurrentProcessId()));
+
+ /* Get path to temporary directory */
+ wchar_t wpath[MAX_PATH+1];
+ DWORD i = GetTempPathW(MAX_PATH, wpath);
+ assert(i > 0);
+
+ /* Ensure that path name ends in directory separator */
+ assert(wpath[i - 1] == '\\');
+
+ /* Append random prefix */
+ DWORD k;
+ for (k = 0; k < 8; k++) {
+ /* Generate random character */
+ char c = "abcdefghijklmnopqrstuvwxyz"[rand() % 26];
+
+ /* Append character to path */
+ assert(i < MAX_PATH);
+ wpath[i++] = c;
+ }
+
+ /* Append a wide character to the path name */
+ wpath[i++] = 0x00c4;
+
+ /* Terminate the path name */
+ assert(i < MAX_PATH);
+ wpath[i] = '\0';
+
+ /* Create directory with unicode name */
+ BOOL ok = CreateDirectoryW(wpath, NULL);
+ if (!ok) {
+ DWORD e = GetLastError();
+ wprintf(L"Cannot create directory %ls (code %u)\n", wpath, e);
+ abort();
+ }
+
+ /* Overwrite zero terminator with path separator */
+ assert(i < MAX_PATH);
+ wpath[i++] = '\\';
+
+ /* Append a few unicode characters */
+ assert(i < MAX_PATH);
+ wpath[i++] = 0x00f6;
+ assert(i < MAX_PATH);
+ wpath[i++] = 0x00e4;
+
+ /* Terminate string */
+ assert(i < MAX_PATH);
+ wpath[i] = '\0';
+
+ /* Create file with unicode name */
+ HANDLE fh = CreateFileW(
+ wpath,
+ /* Access */ GENERIC_READ | GENERIC_WRITE,
+ /* Share mode */ 0,
+ /* Security attributes */ NULL,
+ /* Creation disposition */ CREATE_NEW,
+ /* Attributes */ FILE_ATTRIBUTE_NORMAL,
+ /* Template files */ NULL
+ );
+ assert(fh != INVALID_HANDLE_VALUE);
+
+ /* Write some data to file */
+ ok = WriteFile(
+ /* File handle */ fh,
+ /* Pointer to data */ "hep\n",
+ /* Number of bytes to write */ 4,
+ /* Number of bytes written */ NULL,
+ /* Overlapped */ NULL
+ );
+ assert(ok);
+
+ /* Close file */
+ ok = CloseHandle(fh);
+ assert(ok);
+
+ /* Convert file name to UTF-8 */
+ char path[MAX_PATH+1];
+ int n = WideCharToMultiByte(
+ /* Code page to use in conversion */ CP_UTF8,
+ /* Flags */ 0,
+ /* Pointer to unicode string */ wpath,
+ /* Length of unicode string in characters */ i,
+ /* Pointer to output buffer */ path,
+ /* Size of output buffer in bytes */ MAX_PATH,
+ /* Pointer to default character */ NULL,
+ /* Pointer to boolean variable */ NULL
+ );
+ assert(n > 0);
+
+ /* Zero-terminate path */
+ path[(size_t) n] = '\0';
+
+ /* Make sure that fopen() can open the file with UTF-8 file name */
+ FILE *fp = fopen(path, "r");
+ if (!fp) {
+ fprintf(stderr, "Cannot open file %s\n", path);
+ abort();
+ }
+
+ /* Read data from file */
+ char buffer[100];
+ if (fgets(buffer, sizeof(buffer), fp) == NULL) {
+ fprintf(stderr, "Cannot read file %s\n", path);
+ abort();
+ }
+
+ /* Make sure that we got the file contents right */
+ assert(buffer[0] == 'h');
+ assert(buffer[1] == 'e');
+ assert(buffer[2] == 'p');
+ assert(buffer[3] == '\n');
+ assert(buffer[4] == '\0');
+
+ /* Close file */
+ fclose(fp);
+
+ /* Truncate path name to the last directory separator */
+ i = 0;
+ k = 0;
+ while (path[k] != '\0') {
+ if (path[k] == '\\' || path[k] == '/') {
+ i = k;
+ }
+ k++;
+ }
+ path[i] = '\0';
+
+ /* Ensure that opendir() can open the directory with UTF-8 name */
+ DIR *dir = opendir(path);
+ if (dir == NULL) {
+ fprintf(stderr, "Cannot open directory %s\n", path);
+ abort();
+ }
+
+ /* Read entries */
+ int counter = 0;
+ struct dirent *entry;
+ while ((entry = readdir(dir)) != NULL) {
+ /* Skip pseudo directories */
+ if (strcmp(entry->d_name, ".") == 0) {
+ continue;
+ }
+ if (strcmp(entry->d_name, "..") == 0) {
+ continue;
+ }
+
+ /* Found a file */
+ counter++;
+ assert(entry->d_type == DT_REG);
+
+ /* Append file name to path */
+ k = i;
+ assert(i < MAX_PATH);
+ path[i++] = '\\';
+ DWORD x = 0;
+ while (entry->d_name[x] != '\0') {
+ assert(i < MAX_PATH);
+ path[i++] = entry->d_name[x++];
+ }
+ assert(i < MAX_PATH);
+ path[i] = '\0';
+
+ /* Reset buffer */
+ for (x = 0; x < sizeof(buffer); x++) {
+ buffer[x] = '\0';
+ }
+
+ /* Open file for read */
+ fp = fopen(path, "r");
+ if (!fp) {
+ fprintf(stderr, "Cannot open file %s\n", path);
+ abort();
+ }
+
+ /* Read data from file */
+ if (fgets(buffer, sizeof(buffer), fp) == NULL) {
+ fprintf(stderr, "Cannot read file %s\n", path);
+ abort();
+ }
+
+ /* Make sure that we got the file contents right */
+ assert(buffer[0] == 'h');
+ assert(buffer[1] == 'e');
+ assert(buffer[2] == 'p');
+ assert(buffer[3] == '\n');
+ assert(buffer[4] == '\0');
+
+ /* Close file */
+ fclose(fp);
+ }
+ assert(counter == 1);
+
+ /* Close directory */
+ closedir(dir);
+#else
+ /* Linux */
+ (void) argc;
+ (void) argv;
+#endif
+ return EXIT_SUCCESS;
+}
diff --git a/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/.suo b/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/.suo
new file mode 100644
index 00000000..99c2825a
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/.suo differ
diff --git a/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/Browse.VC.db b/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/Browse.VC.db
new file mode 100644
index 00000000..84f5da06
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/Browse.VC.db differ
diff --git a/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/ipch/AutoPCH/22511dbf0c9d6995/MAIN.ipch b/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/ipch/AutoPCH/22511dbf0c9d6995/MAIN.ipch
new file mode 100644
index 00000000..efab642f
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/ipch/AutoPCH/22511dbf0c9d6995/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/ipch/AutoPCH/753db2aa404ac7b8/MAINWITHSORTINGCOMPARISON.ipch b/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/ipch/AutoPCH/753db2aa404ac7b8/MAINWITHSORTINGCOMPARISON.ipch
new file mode 100644
index 00000000..7bcc1dcb
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/ipch/AutoPCH/753db2aa404ac7b8/MAINWITHSORTINGCOMPARISON.ipch differ
diff --git a/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/ipch/AutoPCH/99269c7eb42c3898/SORT.ipch b/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/ipch/AutoPCH/99269c7eb42c3898/SORT.ipch
new file mode 100644
index 00000000..b9e7ab9e
Binary files /dev/null and b/FinishedTasks_HW/Task_5_HW_Sorting/.vs/Task_5_HW_Sorting/v16/ipch/AutoPCH/99269c7eb42c3898/SORT.ipch differ
diff --git a/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting.sln b/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting.sln
new file mode 100644
index 00000000..c1d3a22d
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task_5_HW_Sorting", "Task_5_HW_Sorting\Task_5_HW_Sorting.vcxproj", "{DE969B76-35EF-4126-BC52-FB05CF59EEFE}"
+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
+ {DE969B76-35EF-4126-BC52-FB05CF59EEFE}.Debug|x64.ActiveCfg = Debug|x64
+ {DE969B76-35EF-4126-BC52-FB05CF59EEFE}.Debug|x64.Build.0 = Debug|x64
+ {DE969B76-35EF-4126-BC52-FB05CF59EEFE}.Debug|x86.ActiveCfg = Debug|Win32
+ {DE969B76-35EF-4126-BC52-FB05CF59EEFE}.Debug|x86.Build.0 = Debug|Win32
+ {DE969B76-35EF-4126-BC52-FB05CF59EEFE}.Release|x64.ActiveCfg = Release|x64
+ {DE969B76-35EF-4126-BC52-FB05CF59EEFE}.Release|x64.Build.0 = Release|x64
+ {DE969B76-35EF-4126-BC52-FB05CF59EEFE}.Release|x86.ActiveCfg = Release|Win32
+ {DE969B76-35EF-4126-BC52-FB05CF59EEFE}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {30A15F8E-E08E-4390-A1DF-32AB44358984}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/Task_5_HW_Sorting.vcxproj b/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/Task_5_HW_Sorting.vcxproj
new file mode 100644
index 00000000..f58bcd10
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/Task_5_HW_Sorting.vcxproj
@@ -0,0 +1,147 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {de969b76-35ef-4126-bc52-fb05cf59eefe}
+ Task5HWSorting
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/Task_5_HW_Sorting.vcxproj.filters b/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/Task_5_HW_Sorting.vcxproj.filters
new file mode 100644
index 00000000..669bc4ea
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/Task_5_HW_Sorting.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/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/Task_5_HW_Sorting.vcxproj.user b/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/Task_5_HW_Sorting.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/Task_5_HW_Sorting.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/main.c b/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/main.c
new file mode 100644
index 00000000..19bd2791
--- /dev/null
+++ b/FinishedTasks_HW/Task_5_HW_Sorting/Task_5_HW_Sorting/main.c
@@ -0,0 +1,122 @@
+// Copyright 2021 Novostroev Ivan
+
+#include
+#include
+#include
+#include
+
+long int sortInsert(int* array, int size) { //
+ int temp;
+ long int swaps = 0;
+ for (int i = 1; i < size; i++)
+ for (int j = i; j > 0 && array[j - 1] > array[j]; j--) {
+ temp = array[j - 1];
+ array[j - 1] = array[j];
+ array[j] = temp;
+ swaps++;
+ }
+ return swaps;
+}
+
+int sortHoare(int* array, int first, int last) { //
+ int swaps = 0;
+ int i = first, j = last, x = array[(first + last) / 2];
+ do {
+ while (array[i] < x) i++;
+ while (array[j] > x) j--;
+ if (i <= j) {
+ if (array[i] > array[j]) {
+ int temp = array[i];
+ array[i] = array[j];
+ array[j] = temp;
+ swaps++;
+ }
+ i++;
+ j--;
+ }
+ } while (i <= j);
+ if (i < last)
+ sortHoare(array, i, last);
+ if (first < j)
+ sortHoare(array, first, j);
+ return swaps;
+}
+
+void shiftDown(int* array, int root, int bottom) { //
+ int maxChild;
+ int done = 0;
+ while ((root * 2 <= bottom) && (!done)) {
+ if (root * 2 == bottom)
+ maxChild = root * 2;
+ else if (array[root * 2] > array[root * 2 + 1])
+ maxChild = root * 2;
+ else
+ maxChild = root * 2 + 1;
+ if (array[root] < array[maxChild]) {
+ int temp = array[root];
+ array[root] = array[maxChild];
+ array[maxChild] = temp;
+ root = maxChild;
+ }
+ else
+ done = 1;
+ }
+}
+
+int sortHeap(int* array, int size) {
+ int swaps = 0;
+ for (int i = (size / 2); i >= 0; i--)
+ shiftDown(array, i, size - 1);
+ for (int i = size - 1; i >= 1; i--) {
+ int temp = array[0];
+ array[0] = array[i];
+ array[i] = temp;
+ swaps++;
+ shiftDown(array, 0, i - 1);
+ }
+ return swaps;
+}
+
+void generateRandNumber(int* array, int size, int min, int max) { //
+ for (int i = 0; i < size; i++)
+ array[i] = min + rand() % (max - min + 1);
+}
+
+int main() {
+ char* locale = setlocale(LC_ALL, "");
+
+ srand(time(NULL));
+
+ float time;
+ int* array = NULL;
+ int size = 0;
+ long int swaps = 0;
+ int min, max;
+
+ printf(" : ");
+ scanf_s("%d", &size);
+
+ array = (int*)malloc(size * sizeof(int));
+
+ printf(" : ");
+ scanf_s("%d %d", &min, &max);
+
+ generateRandNumber(array, size, min, max);
+ time = clock();
+ swaps = sortInsert(array, size);
+ time = clock() - time;
+ printf("\n | | \n");
+ printf(" | %.2fs | %ld\n", time / 1000, swaps);
+
+ generateRandNumber(array, size, min, max);
+ time = clock();
+ swaps = sortHoare(array, 0, size - 1);
+ time = clock() - time;
+ printf(" | %.2fs | %d\n", time / 1000, swaps);
+
+ generateRandNumber(array, size, min, max);
+ time = clock();
+ swaps = sortHeap(array, size);
+ time = clock() - time;
+ printf(" | %.2fs | %d\n", time / 1000, swaps);
+}
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/.suo b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/.suo
new file mode 100644
index 00000000..d3a032d0
Binary files /dev/null and b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/.suo differ
diff --git a/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/Browse.VC.db b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/Browse.VC.db
new file mode 100644
index 00000000..5d72be9a
Binary files /dev/null and b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/Browse.VC.db differ
diff --git a/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/bb4e155c402e61e6/FUNCTIONS.ipch b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/bb4e155c402e61e6/FUNCTIONS.ipch
new file mode 100644
index 00000000..1f7cafa8
Binary files /dev/null and b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/bb4e155c402e61e6/FUNCTIONS.ipch differ
diff --git a/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/bb4e1c5c402e6dcb/FUNCTIONS.ipch b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/bb4e1c5c402e6dcb/FUNCTIONS.ipch
new file mode 100644
index 00000000..1d5d7f3e
Binary files /dev/null and b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/bb4e1c5c402e6dcb/FUNCTIONS.ipch differ
diff --git a/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/cb239082ef389c5/MAIN.ipch b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/cb239082ef389c5/MAIN.ipch
new file mode 100644
index 00000000..e343e403
Binary files /dev/null and b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/cb239082ef389c5/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/cb23e082ef39244/MAIN.ipch b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/cb23e082ef39244/MAIN.ipch
new file mode 100644
index 00000000..39283312
Binary files /dev/null and b/FinishedTasks_HW/Task_6_HW/.vs/Task_6_HW/v16/ipch/AutoPCH/cb23e082ef39244/MAIN.ipch differ
diff --git a/FinishedTasks_HW/Task_6_HW/Task_6_HW.sln b/FinishedTasks_HW/Task_6_HW/Task_6_HW.sln
new file mode 100644
index 00000000..5a6bab47
--- /dev/null
+++ b/FinishedTasks_HW/Task_6_HW/Task_6_HW.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31702.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task_6_HW", "Task_6_HW\Task_6_HW.vcxproj", "{6162C46D-BDBF-472C-B9E6-86180085BF68}"
+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
+ {6162C46D-BDBF-472C-B9E6-86180085BF68}.Debug|x64.ActiveCfg = Debug|x64
+ {6162C46D-BDBF-472C-B9E6-86180085BF68}.Debug|x64.Build.0 = Debug|x64
+ {6162C46D-BDBF-472C-B9E6-86180085BF68}.Debug|x86.ActiveCfg = Debug|Win32
+ {6162C46D-BDBF-472C-B9E6-86180085BF68}.Debug|x86.Build.0 = Debug|Win32
+ {6162C46D-BDBF-472C-B9E6-86180085BF68}.Release|x64.ActiveCfg = Release|x64
+ {6162C46D-BDBF-472C-B9E6-86180085BF68}.Release|x64.Build.0 = Release|x64
+ {6162C46D-BDBF-472C-B9E6-86180085BF68}.Release|x86.ActiveCfg = Release|Win32
+ {6162C46D-BDBF-472C-B9E6-86180085BF68}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {17DDB440-0CF7-49DD-9A13-CF676D7D6C75}
+ EndGlobalSection
+EndGlobal
diff --git a/FinishedTasks_HW/Task_6_HW/Task_6_HW/Task_6_HW.vcxproj b/FinishedTasks_HW/Task_6_HW/Task_6_HW/Task_6_HW.vcxproj
new file mode 100644
index 00000000..c35495c9
--- /dev/null
+++ b/FinishedTasks_HW/Task_6_HW/Task_6_HW/Task_6_HW.vcxproj
@@ -0,0 +1,151 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {6162c46d-bdbf-472c-b9e6-86180085bf68}
+ Task6HW
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ 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/FinishedTasks_HW/Task_6_HW/Task_6_HW/Task_6_HW.vcxproj.filters b/FinishedTasks_HW/Task_6_HW/Task_6_HW/Task_6_HW.vcxproj.filters
new file mode 100644
index 00000000..537870c1
--- /dev/null
+++ b/FinishedTasks_HW/Task_6_HW/Task_6_HW/Task_6_HW.vcxproj.filters
@@ -0,0 +1,30 @@
+
+
+
+
+ {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/FinishedTasks_HW/Task_6_HW/Task_6_HW/Task_6_HW.vcxproj.user b/FinishedTasks_HW/Task_6_HW/Task_6_HW/Task_6_HW.vcxproj.user
new file mode 100644
index 00000000..88a55094
--- /dev/null
+++ b/FinishedTasks_HW/Task_6_HW/Task_6_HW/Task_6_HW.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_6_HW/Task_6_HW/functions.c b/FinishedTasks_HW/Task_6_HW/Task_6_HW/functions.c
new file mode 100644
index 00000000..2c0870dc
--- /dev/null
+++ b/FinishedTasks_HW/Task_6_HW/Task_6_HW/functions.c
@@ -0,0 +1,57 @@
+#include "functions.h"
+
+long long Factorial(int N) {
+ return (N < 2) ? 1 : N * Factorial(N - 1);
+}
+
+struct Answer sinTalor(double x, double eps, int N, int i) {
+ struct Answer result;
+ result.etalon = sin(x);
+ result.result = 0;
+ for (i = 1; i <= N; i++) {
+ result.result += pow(-1, i + 1) * pow(x, 2 * i - 1) / (long double)Factorial(2 * i - 1);
+ if (fabs(result.etalon - result.result) < eps) break;
+ }
+ result.difference = fabs(result.etalon - result.result);
+ result.count = i - 1;
+ return result;
+}
+
+struct Answer cosTalor(double x, double eps, int N, int i) {
+ struct Answer result;
+ result.etalon = cos(x);
+ result.result = 0;
+ for (i = 0; i < N; i++) {
+ result.result += pow(-1, i) * pow(x, 2 * i) / (long double)Factorial(2 * i);
+ if (fabs(result.etalon - result.result) < eps) break;
+ }
+ result.difference = fabs(result.etalon - result.result);
+ result.count = i;
+ return result;
+}
+
+struct Answer expTalor(double x, double eps, int N, int i) {
+ struct Answer result;
+ result.etalon = exp(x);
+ result.result = 0;
+ for (i = 0; i < N; i++) {
+ result.result += pow(x, i) / (long double)Factorial(i);
+ if (fabs(result.etalon - result.result) < eps) break;
+ }
+ result.difference = fabs(result.etalon - result.result);
+ result.count = i;
+ return result;
+}
+
+struct Answer arcctgTalor(double x, double eps, int N, int i) {
+ struct Answer result;
+ result.etalon = exp(x);
+ result.result = M_PI_2;
+ for (i = 0; i < N; i++) {
+ result.result += pow(-1, i + 1) * pow(x, 2 * i + 1) / (long double)(2 * i + 1);;
+ if (fabs(result.etalon - result.result) < eps) break;
+ }
+ result.difference = fabs(result.etalon - result.result);
+ result.count = i;
+ return result;
+}
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_6_HW/Task_6_HW/functions.h b/FinishedTasks_HW/Task_6_HW/Task_6_HW/functions.h
new file mode 100644
index 00000000..251bb432
--- /dev/null
+++ b/FinishedTasks_HW/Task_6_HW/Task_6_HW/functions.h
@@ -0,0 +1,28 @@
+#ifndef _FUNC_H
+#define _FUNC_H
+#define _CRT_SECURE_NO_WARNINGS
+
+#include
+#include
+#include
+#define _USE_MATH_DEFINES
+#include
+
+struct Answer
+{
+ double result;
+ double difference;
+ double etalon;
+ int count;
+};
+
+struct Answer finalResult;
+
+long long Factorial(int N);
+
+struct Answer sinTalor(double x, double eps, int N, int i);
+struct Answer cosTalor(double x, double eps, int N, int i);
+struct Answer expTalor(double x, double eps, int N, int i);
+struct Answer arcctgTalor(double x, double eps, int N, int i);
+
+#endif
\ No newline at end of file
diff --git a/FinishedTasks_HW/Task_6_HW/Task_6_HW/main.c b/FinishedTasks_HW/Task_6_HW/Task_6_HW/main.c
new file mode 100644
index 00000000..e33bfada
--- /dev/null
+++ b/FinishedTasks_HW/Task_6_HW/Task_6_HW/main.c
@@ -0,0 +1,64 @@
+#include "functions.h"
+
+typedef struct Answer(*funtionsType) (double, double, int, int);
+funtionsType functions[4];
+
+int main() {
+ int VariantOfProg, VariantOfFunction, N = 0, NMax = 0, i = 0;
+ double x = 0, etalon = 0, difference = 0;
+ double eps = 0.000001;
+
+ printf("Select a program:\n");
+ printf("1. One-time calculation of the function at a given point.\n");
+ printf("2. Serial experiment.\n");
+ scanf_s("%d", &VariantOfProg);
+
+ functions[0] = sinTalor;
+ functions[1] = cosTalor;
+ functions[2] = expTalor;
+ functions[3] = arcctgTalor;
+
+ printf("Select function:\n");
+ printf("1. sin(x)\n");
+ printf("2. cos(x)\n");
+ printf("3. exp(x)\n");
+ printf("4. arcctg(x), |x| <= 1\n");
+ scanf_s("%d", &VariantOfFunction);
+ printf("Enter point x:\n");
+ scanf_s("%lf", &x);
+
+ switch (VariantOfProg)
+ {
+ case 1:
+ printf("Enter the precision of the calculation (from 0.000001 and more):\n");
+ scanf_s("%lf", &eps);
+ printf("Enter the number of elements to calculate (N - from 1 to 1000):\n");
+ scanf_s("%d", &N);
+
+ finalResult = functions[VariantOfFunction - 1](x, eps, N, i);
+
+ printf("Etalon value: %lf\n", finalResult.etalon);
+ printf("Taylor function value: %lf\n", finalResult.result);
+ printf("Difference between Taylor and reference:%lf\n", finalResult.difference);
+ printf("The number of terms that was calculated: %d\n", finalResult.count);
+
+ break;
+ case 2:
+ srand(time(NULL));
+ printf("Enter the number of experiments (NMax - 1 to 25):\n");
+ scanf_s("%d", &NMax);
+
+ for (int i = 1; i <= NMax; i++) {
+ N = 1 + rand() % (1000 - 1 + 1);
+ finalResult = functions[VariantOfFunction - 1](x, eps, N, i);
+ printf("%2d. Etalon: %lf \t", i, finalResult.etalon);
+ printf("Summand: %d \t", N);
+ printf("Result: %Lf \t", finalResult.result);
+ printf("Difference: %lf \n", finalResult.difference);
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
\ No newline at end of file
diff --git a/TasksInTerminalClass/.vs/ProjectSettings.json b/TasksInTerminalClass/.vs/ProjectSettings.json
new file mode 100644
index 00000000..4e72f3be
--- /dev/null
+++ b/TasksInTerminalClass/.vs/ProjectSettings.json
@@ -0,0 +1,3 @@
+{
+ "CurrentProjectSetting": "Нет конфигураций"
+}
\ No newline at end of file
diff --git a/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/.suo b/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/.suo
new file mode 100644
index 00000000..5a1cbc55
Binary files /dev/null and b/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/.suo differ
diff --git a/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/Browse.VC.db b/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/Browse.VC.db
new file mode 100644
index 00000000..de79bd78
Binary files /dev/null and b/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/Browse.VC.db differ
diff --git a/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/ipch/AutoPCH/c2692af217b79c17/OKR.ipch b/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/ipch/AutoPCH/c2692af217b79c17/OKR.ipch
new file mode 100644
index 00000000..a819a717
Binary files /dev/null and b/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/ipch/AutoPCH/c2692af217b79c17/OKR.ipch differ
diff --git a/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/ipch/AutoPCH/e7085701408d59c8/TREYG.ipch b/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/ipch/AutoPCH/e7085701408d59c8/TREYG.ipch
new file mode 100644
index 00000000..021669b2
Binary files /dev/null and b/TasksInTerminalClass/.vs/TasksInTerminalClass/v16/ipch/AutoPCH/e7085701408d59c8/TREYG.ipch differ
diff --git a/TasksInTerminalClass/.vs/VSWorkspaceState.json b/TasksInTerminalClass/.vs/VSWorkspaceState.json
new file mode 100644
index 00000000..58c65598
--- /dev/null
+++ b/TasksInTerminalClass/.vs/VSWorkspaceState.json
@@ -0,0 +1,10 @@
+{
+ "ExpandedNodes": [
+ "",
+ "\\PloshadiTreyg",
+ "\\PloshadiTreyg\\Ploshadi",
+ "\\PloshadiTreyg\\PloshadOKRY"
+ ],
+ "SelectedNode": "\\PloshadiTreyg\\PloshadOKRY\\OKR.c",
+ "PreviewInSolutionExplorer": false
+}
\ No newline at end of file
diff --git a/TasksInTerminalClass/.vs/slnx.sqlite b/TasksInTerminalClass/.vs/slnx.sqlite
new file mode 100644
index 00000000..fc9f4a89
Binary files /dev/null and b/TasksInTerminalClass/.vs/slnx.sqlite differ