diff --git a/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/FileContentIndex/9bfd595d-77a4-4288-8d63-36c372b949b8.vsidx b/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/FileContentIndex/9bfd595d-77a4-4288-8d63-36c372b949b8.vsidx new file mode 100644 index 0000000..2adf172 Binary files /dev/null and b/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/FileContentIndex/9bfd595d-77a4-4288-8d63-36c372b949b8.vsidx differ diff --git a/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/FileContentIndex/read.lock b/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/v17/.suo b/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/v17/.suo new file mode 100644 index 0000000..8206f91 Binary files /dev/null and b/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/v17/.suo differ diff --git a/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/v17/Browse.VC.db b/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/v17/Browse.VC.db new file mode 100644 index 0000000..98a75c7 Binary files /dev/null and b/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/v17/Browse.VC.db differ diff --git a/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/v17/ipch/AutoPCH/475c007f108f4851/MAIN.ipch b/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/v17/ipch/AutoPCH/475c007f108f4851/MAIN.ipch new file mode 100644 index 0000000..c04e84a Binary files /dev/null and b/HomeWork1_ClassRealize/.vs/HomeWork1_ClassRealize/v17/ipch/AutoPCH/475c007f108f4851/MAIN.ipch differ diff --git a/HomeWork1_ClassRealize/HomeWork1/HomeWork1.vcxproj b/HomeWork1_ClassRealize/HomeWork1/HomeWork1.vcxproj new file mode 100644 index 0000000..644493e --- /dev/null +++ b/HomeWork1_ClassRealize/HomeWork1/HomeWork1.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {e97fe102-dce1-4bf1-bc16-2b4d5761f5a8} + HomeWork1 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/HomeWork1_ClassRealize/HomeWork1/HomeWork1.vcxproj.filters b/HomeWork1_ClassRealize/HomeWork1/HomeWork1.vcxproj.filters new file mode 100644 index 0000000..e8deb3d --- /dev/null +++ b/HomeWork1_ClassRealize/HomeWork1/HomeWork1.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/HomeWork1_ClassRealize/HomeWork1/HomeWork1.vcxproj.user b/HomeWork1_ClassRealize/HomeWork1/HomeWork1.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/HomeWork1_ClassRealize/HomeWork1/HomeWork1.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/HomeWork1_ClassRealize/HomeWork1/main.cpp b/HomeWork1_ClassRealize/HomeWork1/main.cpp new file mode 100644 index 0000000..5212d8e --- /dev/null +++ b/HomeWork1_ClassRealize/HomeWork1/main.cpp @@ -0,0 +1,78 @@ +#include + +class Coordinates { + + int x, y; + +public: + + Coordinates() : x(11), y(17) {}; + + Coordinates(const Coordinates& coord) { + x = coord.x; + y = coord.y; + } + + void set_coordinates(int a, int b) { + x = a; + y = b; + } + + int getx() const { return x; } + int gety() const { return y; } + + Coordinates& operator +(const Coordinates& other) { + Coordinates sum_coordinates; + sum_coordinates.x = this->x + other.x; + sum_coordinates.y = this->y + other.y; + return sum_coordinates; + } + + Coordinates& operator -(const Coordinates& other) { + Coordinates dif_coordinates; + dif_coordinates.x = other.x - this->x; + dif_coordinates.y = other.y - this->y; + return dif_coordinates; + } + + Coordinates& operator =(const Coordinates& other) { + Coordinates equal_coordinates; + equal_coordinates.x = this->x = other.x; + equal_coordinates.y = this->y = other.y; + return equal_coordinates; + } + + friend std::ostream& operator <<(std::ostream& out, Coordinates& coord) { + out << "X : " << coord.x << "Y : " << coord.y; + return out; + } + + void CPrint() { + std::cout << "Sys_X : " << x << "\n" << "Sys_Y : " << y << "\n"; + } +}; + +int main(int argc, const char* argv[]) { + + std::cout << "Hello, programm - Coord_Class : started." << std::endl; + Coordinates coordinates = Coordinates(); + coordinates.CPrint(); + + int user_x, user_y; + std::cout << "Enter your coordinates (x, y) : " << std::endl; + std::cin >> user_x; + std::cin >> user_y; + std::cout << "Your coordinates" << "\n" << "User_X : " << user_x << "\n" << "User_Y : " << user_y << "\n"; + + Coordinates coord_1; + coord_1.set_coordinates(user_x, user_y); + + Coordinates sum_coord = coord_1.operator+(Coordinates()); + std::cout << "Sum coordinates = " << sum_coord.getx() << " " << sum_coord.gety() << std::endl; + + Coordinates dif_coord = coord_1.operator-(Coordinates()); + std::cout << "Dif coordinates = " << dif_coord.getx() << " " << dif_coord.gety() << std::endl; + + Coordinates equal_coord = coord_1.operator=(Coordinates()); + std::cout << "Equal coordinates - " << equal_coord.getx() << " " << equal_coord.gety() << std::endl; +} \ No newline at end of file diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.exe.recipe b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.exe.recipe new file mode 100644 index 0000000..2471c0c --- /dev/null +++ b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.exe.recipe @@ -0,0 +1,11 @@ + + + + + D:\Github\CPPlang2K\HomeWork1_ClassRealize\x64\Debug\HomeWork1.exe + + + + + + \ No newline at end of file diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.ilk b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.ilk new file mode 100644 index 0000000..8571a69 Binary files /dev/null and b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.ilk differ diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.log b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.log new file mode 100644 index 0000000..6655487 --- /dev/null +++ b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.log @@ -0,0 +1,5 @@ + main.cpp +D:\Github\CPPlang2K\HomeWork1_ClassRealize\HomeWork1\main.cpp(28): warning C4172: возвращение адреса локальной или временной переменной : sum_coordinates +D:\Github\CPPlang2K\HomeWork1_ClassRealize\HomeWork1\main.cpp(35): warning C4172: возвращение адреса локальной или временной переменной : dif_coordinates +D:\Github\CPPlang2K\HomeWork1_ClassRealize\HomeWork1\main.cpp(42): warning C4172: возвращение адреса локальной или временной переменной : equal_coordinates + HomeWork1.vcxproj -> D:\Github\CPPlang2K\HomeWork1_ClassRealize\x64\Debug\HomeWork1.exe diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/CL.command.1.tlog b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/CL.command.1.tlog new file mode 100644 index 0000000..277a75d Binary files /dev/null and b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/CL.command.1.tlog differ diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/CL.read.1.tlog b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/CL.read.1.tlog new file mode 100644 index 0000000..ca1dbb2 Binary files /dev/null and b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/CL.read.1.tlog differ diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/CL.write.1.tlog b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/CL.write.1.tlog new file mode 100644 index 0000000..d56c25c Binary files /dev/null and b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/CL.write.1.tlog differ diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/HomeWork1.lastbuildstate b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/HomeWork1.lastbuildstate new file mode 100644 index 0000000..f504779 --- /dev/null +++ b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/HomeWork1.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0: +Debug|x64|D:\Github\CPPlang2K\HomeWork1_ClassRealize\| diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/link.command.1.tlog b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/link.command.1.tlog new file mode 100644 index 0000000..2b1e720 Binary files /dev/null and b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/link.command.1.tlog differ diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/link.read.1.tlog b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/link.read.1.tlog new file mode 100644 index 0000000..33809d8 Binary files /dev/null and b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/link.read.1.tlog differ diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/link.write.1.tlog b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/link.write.1.tlog new file mode 100644 index 0000000..1578b72 Binary files /dev/null and b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/HomeWork1.tlog/link.write.1.tlog differ diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/main.obj b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/main.obj new file mode 100644 index 0000000..a87de3d Binary files /dev/null and b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/main.obj differ diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/vc143.idb b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/vc143.idb new file mode 100644 index 0000000..36f78e8 Binary files /dev/null and b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/vc143.idb differ diff --git a/HomeWork1_ClassRealize/HomeWork1/x64/Debug/vc143.pdb b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/vc143.pdb new file mode 100644 index 0000000..87bb9da Binary files /dev/null and b/HomeWork1_ClassRealize/HomeWork1/x64/Debug/vc143.pdb differ diff --git a/HomeWork1_ClassRealize/HomeWork1_ClassRealize.sln b/HomeWork1_ClassRealize/HomeWork1_ClassRealize.sln new file mode 100644 index 0000000..0236a56 --- /dev/null +++ b/HomeWork1_ClassRealize/HomeWork1_ClassRealize.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32901.215 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HomeWork1", "HomeWork1\HomeWork1.vcxproj", "{E97FE102-DCE1-4BF1-BC16-2B4D5761F5A8}" +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 + {E97FE102-DCE1-4BF1-BC16-2B4D5761F5A8}.Debug|x64.ActiveCfg = Debug|x64 + {E97FE102-DCE1-4BF1-BC16-2B4D5761F5A8}.Debug|x64.Build.0 = Debug|x64 + {E97FE102-DCE1-4BF1-BC16-2B4D5761F5A8}.Debug|x86.ActiveCfg = Debug|Win32 + {E97FE102-DCE1-4BF1-BC16-2B4D5761F5A8}.Debug|x86.Build.0 = Debug|Win32 + {E97FE102-DCE1-4BF1-BC16-2B4D5761F5A8}.Release|x64.ActiveCfg = Release|x64 + {E97FE102-DCE1-4BF1-BC16-2B4D5761F5A8}.Release|x64.Build.0 = Release|x64 + {E97FE102-DCE1-4BF1-BC16-2B4D5761F5A8}.Release|x86.ActiveCfg = Release|Win32 + {E97FE102-DCE1-4BF1-BC16-2B4D5761F5A8}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5ABD7BD3-D9DA-44C5-B8FD-C60A9F00478B} + EndGlobalSection +EndGlobal diff --git a/HomeWork1_ClassRealize/x64/Debug/HomeWork1.exe b/HomeWork1_ClassRealize/x64/Debug/HomeWork1.exe new file mode 100644 index 0000000..4c1e351 Binary files /dev/null and b/HomeWork1_ClassRealize/x64/Debug/HomeWork1.exe differ diff --git a/HomeWork1_ClassRealize/x64/Debug/HomeWork1.pdb b/HomeWork1_ClassRealize/x64/Debug/HomeWork1.pdb new file mode 100644 index 0000000..67e6b87 Binary files /dev/null and b/HomeWork1_ClassRealize/x64/Debug/HomeWork1.pdb differ diff --git a/Matrix_OctoberFive/.vs/Matrix_OctoberFive/FileContentIndex/92402942-37bb-48ae-9f50-5279d93fdb81.vsidx b/Matrix_OctoberFive/.vs/Matrix_OctoberFive/FileContentIndex/92402942-37bb-48ae-9f50-5279d93fdb81.vsidx new file mode 100644 index 0000000..59cbea4 Binary files /dev/null and b/Matrix_OctoberFive/.vs/Matrix_OctoberFive/FileContentIndex/92402942-37bb-48ae-9f50-5279d93fdb81.vsidx differ diff --git a/Matrix_OctoberFive/.vs/Matrix_OctoberFive/FileContentIndex/read.lock b/Matrix_OctoberFive/.vs/Matrix_OctoberFive/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/Matrix_OctoberFive/.vs/Matrix_OctoberFive/v17/.suo b/Matrix_OctoberFive/.vs/Matrix_OctoberFive/v17/.suo new file mode 100644 index 0000000..f117c05 Binary files /dev/null and b/Matrix_OctoberFive/.vs/Matrix_OctoberFive/v17/.suo differ diff --git a/Matrix_OctoberFive/.vs/Matrix_OctoberFive/v17/Browse.VC.db b/Matrix_OctoberFive/.vs/Matrix_OctoberFive/v17/Browse.VC.db new file mode 100644 index 0000000..59d6a3f Binary files /dev/null and b/Matrix_OctoberFive/.vs/Matrix_OctoberFive/v17/Browse.VC.db differ diff --git a/Matrix_OctoberFive/.vs/Matrix_OctoberFive/v17/ipch/AutoPCH/3da6f5c16f82e040/MAIN.ipch b/Matrix_OctoberFive/.vs/Matrix_OctoberFive/v17/ipch/AutoPCH/3da6f5c16f82e040/MAIN.ipch new file mode 100644 index 0000000..1a76b32 Binary files /dev/null and b/Matrix_OctoberFive/.vs/Matrix_OctoberFive/v17/ipch/AutoPCH/3da6f5c16f82e040/MAIN.ipch differ diff --git a/Matrix_OctoberFive/Matrix_OctoberFive.sln b/Matrix_OctoberFive/Matrix_OctoberFive.sln new file mode 100644 index 0000000..ac7c0db --- /dev/null +++ b/Matrix_OctoberFive/Matrix_OctoberFive.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32901.215 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Matrix_OctoberFive", "Matrix_OctoberFive\Matrix_OctoberFive.vcxproj", "{FAFEF8C2-7ABB-4F60-80B0-BE8483F6ED5F}" +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 + {FAFEF8C2-7ABB-4F60-80B0-BE8483F6ED5F}.Debug|x64.ActiveCfg = Debug|x64 + {FAFEF8C2-7ABB-4F60-80B0-BE8483F6ED5F}.Debug|x64.Build.0 = Debug|x64 + {FAFEF8C2-7ABB-4F60-80B0-BE8483F6ED5F}.Debug|x86.ActiveCfg = Debug|Win32 + {FAFEF8C2-7ABB-4F60-80B0-BE8483F6ED5F}.Debug|x86.Build.0 = Debug|Win32 + {FAFEF8C2-7ABB-4F60-80B0-BE8483F6ED5F}.Release|x64.ActiveCfg = Release|x64 + {FAFEF8C2-7ABB-4F60-80B0-BE8483F6ED5F}.Release|x64.Build.0 = Release|x64 + {FAFEF8C2-7ABB-4F60-80B0-BE8483F6ED5F}.Release|x86.ActiveCfg = Release|Win32 + {FAFEF8C2-7ABB-4F60-80B0-BE8483F6ED5F}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {90AF5FDB-B644-4FEB-AD6A-C942E6CA6EE7} + EndGlobalSection +EndGlobal diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/Matrix_OctoberFive.vcxproj b/Matrix_OctoberFive/Matrix_OctoberFive/Matrix_OctoberFive.vcxproj new file mode 100644 index 0000000..b83bf17 --- /dev/null +++ b/Matrix_OctoberFive/Matrix_OctoberFive/Matrix_OctoberFive.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {fafef8c2-7abb-4f60-80b0-be8483f6ed5f} + MatrixOctoberFive + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/Matrix_OctoberFive.vcxproj.filters b/Matrix_OctoberFive/Matrix_OctoberFive/Matrix_OctoberFive.vcxproj.filters new file mode 100644 index 0000000..e8deb3d --- /dev/null +++ b/Matrix_OctoberFive/Matrix_OctoberFive/Matrix_OctoberFive.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/Matrix_OctoberFive/Matrix_OctoberFive/Matrix_OctoberFive.vcxproj.user b/Matrix_OctoberFive/Matrix_OctoberFive/Matrix_OctoberFive.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/Matrix_OctoberFive/Matrix_OctoberFive/Matrix_OctoberFive.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/main.cpp b/Matrix_OctoberFive/Matrix_OctoberFive/main.cpp new file mode 100644 index 0000000..49e8a30 --- /dev/null +++ b/Matrix_OctoberFive/Matrix_OctoberFive/main.cpp @@ -0,0 +1,108 @@ +#include +#include +#include + + +std::vector> multiply(int N, std::vector> A, std::vector> B) { + std::vector> C; + C.assign(N, std::vector(N)); + for (int i = 0; i < N; i++) { + for (int j = 0; j < N; j++) { + for (int k = 0; k < N; k++) + C[i][j] += A[i][k] * B[k][j]; + std::cout << C[i][j] << " " ; + } + std::cout << std::endl; + } + return C; +} + +std::vector> plus(int N, std::vector> A, std::vector> B) { + std::vector> D; + D.assign(N, std::vector(N)); + for (int i = 0; i < N; i++) { + for (int j = 0; j < N; j++) { + D[i][j] = A[i][j] + B[i][j]; + std::cout << D[i][j] << " "; + } + std::cout << std::endl; + } + return D; +} + +std::vector> minus(int N, std::vector> A, std::vector> B) { + std::vector> E; + E.assign(N, std::vector(N)); + for (int i = 0; i < N; i++) { + for (int j = 0; j < N; j++) { + E[i][j] = A[i][j] - B[i][j]; + std::cout << E[i][j] << " "; + } + std::cout << std::endl; + } + return E; +} + + +int main() { + + srand(time(0)); + + std::cout << "Hello! Enter matrix diagonal: " << std::endl; + int N; + std::cin >> N; + std::vector> A; + A.assign(N, std::vector(N)); + std::vector> B; + B.assign(N, std::vector(N)); + + // Generating first Matrix and trade it to triangle Matrix A: + for (int i = 0; i < N; i++) { + for (int j = 0; j < N; j++) { + A[i][j] = 1 + rand() % (15 - 1 + 1); + for (int j = 0; j < i; j++) { + A[i][j] = 0; + } + } + } + std::cout << "Matrix A (triangle) is: " << std::endl; + for (int i = 0; i < N; i++) { + for (int j = 0; j < N; j++) { + std::cout << A[i][j] << "\t"; + } + std::cout << std::endl; + } + std::cout << std::endl; + + // Generating second Matrix and trade it to triangle Matrix B: + for (int i = 0; i < N; i++) { + for (int j = 0; j < N; j++) { + B[i][j] = 1 + rand() % (15 - 1 + 1); + for (int j = 0; j < i; j++) { + B[i][j] = 0; + } + } + } + std::cout << "Matrix B (triangle) is: " << std::endl; + for (int i = 0; i < N; i++) { + for (int j = 0; j < N; j++) { + std::cout << B[i][j] << "\t"; + } + std::cout << std::endl; + } + std::cout << std::endl; + + //Multiply: + std::vector> multiply_res; + std::cout << "Matrix C (Multiply): " << std::endl; + multiply_res = multiply(N, A, B); + //Plus: + std::vector> plus_res; + std::cout << "Matrix D (Plus): " << std::endl; + plus_res = plus(N, A, B); + //Minus: + std::vector> minus_res; + std::cout << "Matrix E (Minus): " << std::endl; + minus_res = minus(N, A, B); +} + diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/CL.command.1.tlog b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/CL.command.1.tlog new file mode 100644 index 0000000..d7212b9 Binary files /dev/null and b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/CL.command.1.tlog differ diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/CL.read.1.tlog b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/CL.read.1.tlog new file mode 100644 index 0000000..471b658 Binary files /dev/null and b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/CL.read.1.tlog differ diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/CL.write.1.tlog b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/CL.write.1.tlog new file mode 100644 index 0000000..f19b50b Binary files /dev/null and b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/CL.write.1.tlog differ diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/Matrix_OctoberFive.lastbuildstate b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/Matrix_OctoberFive.lastbuildstate new file mode 100644 index 0000000..91dc9ff --- /dev/null +++ b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/Matrix_OctoberFive.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0: +Debug|x64|D:\Github\CPPlang2K\Matrix_OctoberFive\| diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/link.command.1.tlog b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/link.command.1.tlog new file mode 100644 index 0000000..2a5d5a2 Binary files /dev/null and b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/link.command.1.tlog differ diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/link.read.1.tlog b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/link.read.1.tlog new file mode 100644 index 0000000..83021f3 Binary files /dev/null and b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/link.read.1.tlog differ diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/link.write.1.tlog b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/link.write.1.tlog new file mode 100644 index 0000000..5821bb9 Binary files /dev/null and b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_O.fafef8c2.tlog/link.write.1.tlog differ diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.exe.recipe b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.exe.recipe new file mode 100644 index 0000000..02fec0c --- /dev/null +++ b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.exe.recipe @@ -0,0 +1,11 @@ + + + + + D:\Github\CPPlang2K\Matrix_OctoberFive\x64\Debug\Matrix_OctoberFive.exe + + + + + + \ No newline at end of file diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.ilk b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.ilk new file mode 100644 index 0000000..f94bb5e Binary files /dev/null and b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.ilk differ diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.log b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.log new file mode 100644 index 0000000..190c9aa --- /dev/null +++ b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.log @@ -0,0 +1,3 @@ + main.cpp +D:\Github\CPPlang2K\Matrix_OctoberFive\Matrix_OctoberFive\main.cpp(49,12): warning C4244: аргумент: преобразование "time_t" в "unsigned int", возможна потеря данных + Matrix_OctoberFive.vcxproj -> D:\Github\CPPlang2K\Matrix_OctoberFive\x64\Debug\Matrix_OctoberFive.exe diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/main.obj b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/main.obj new file mode 100644 index 0000000..37f61d1 Binary files /dev/null and b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/main.obj differ diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/vc143.idb b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/vc143.idb new file mode 100644 index 0000000..0e7c6d1 Binary files /dev/null and b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/vc143.idb differ diff --git a/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/vc143.pdb b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/vc143.pdb new file mode 100644 index 0000000..29e1a73 Binary files /dev/null and b/Matrix_OctoberFive/Matrix_OctoberFive/x64/Debug/vc143.pdb differ diff --git a/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.exe b/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.exe new file mode 100644 index 0000000..984774b Binary files /dev/null and b/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.exe differ diff --git a/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.pdb b/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.pdb new file mode 100644 index 0000000..2dc1f18 Binary files /dev/null and b/Matrix_OctoberFive/x64/Debug/Matrix_OctoberFive.pdb differ diff --git a/MazeLab/MazeLab.sln b/MazeLab/MazeLab.sln new file mode 100644 index 0000000..dcaae99 --- /dev/null +++ b/MazeLab/MazeLab.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33516.290 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MazeLab", "MazeLab\MazeLab.vcxproj", "{2E88F5DA-BE94-423C-8397-A3E1F8235F1C}" +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 + {2E88F5DA-BE94-423C-8397-A3E1F8235F1C}.Debug|x64.ActiveCfg = Debug|x64 + {2E88F5DA-BE94-423C-8397-A3E1F8235F1C}.Debug|x64.Build.0 = Debug|x64 + {2E88F5DA-BE94-423C-8397-A3E1F8235F1C}.Debug|x86.ActiveCfg = Debug|Win32 + {2E88F5DA-BE94-423C-8397-A3E1F8235F1C}.Debug|x86.Build.0 = Debug|Win32 + {2E88F5DA-BE94-423C-8397-A3E1F8235F1C}.Release|x64.ActiveCfg = Release|x64 + {2E88F5DA-BE94-423C-8397-A3E1F8235F1C}.Release|x64.Build.0 = Release|x64 + {2E88F5DA-BE94-423C-8397-A3E1F8235F1C}.Release|x86.ActiveCfg = Release|Win32 + {2E88F5DA-BE94-423C-8397-A3E1F8235F1C}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {203748AE-68B1-470E-AB91-4A8409858DFD} + EndGlobalSection +EndGlobal diff --git a/MazeLab/MazeLab/MazeLab.vcxproj b/MazeLab/MazeLab/MazeLab.vcxproj new file mode 100644 index 0000000..5b12999 --- /dev/null +++ b/MazeLab/MazeLab/MazeLab.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {2e88f5da-be94-423c-8397-a3e1f8235f1c} + MazeLab + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/MazeLab/MazeLab/MazeLab.vcxproj.filters b/MazeLab/MazeLab/MazeLab.vcxproj.filters new file mode 100644 index 0000000..e8deb3d --- /dev/null +++ b/MazeLab/MazeLab/MazeLab.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/MazeLab/MazeLab/MazeLab.vcxproj.user b/MazeLab/MazeLab/MazeLab.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/MazeLab/MazeLab/MazeLab.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/MazeLab/MazeLab/main.cpp b/MazeLab/MazeLab/main.cpp new file mode 100644 index 0000000..71d5717 --- /dev/null +++ b/MazeLab/MazeLab/main.cpp @@ -0,0 +1,169 @@ +#include +#include +#include + +class DSU { + +private: + int* data; + int size; + +public: + DSU(int size) { + data = new int[size]; + this->size = size; + for (; size > 0; size--, make(size)); + } + + void make(int x) { + data[x] = x; + } + + void swap(int *x, int *y) { + int temp = *x; + *x = *y; + *y = temp; + } + + int find(int x) { + if (data[x] == x) + return x; + else + return find(data[x]); + } + + void unite(int x, int y) { + x = find(x); + y = find(y); + if (rand() % 2 == 0) + swap(&x, &y); + data[x] = y; + } + + void print() { + for (int i = 0; i < size; i++) { + std::cout << '(' << data[i] << ')'; + } + } + + ~DSU() { + delete[] data; + } + +}; + +class Maze { + +private: + DSU dsu; + bool* right; + bool* bottom; + +public: + Maze(int size) : dsu(size) { + right = new bool[size]; + bottom = new bool[size]; + } + + bool notInOnePath(int x_wall, int y_wall) { return dsu.find(x_wall) != dsu.find(y_wall); } + void continuePath(int x, int y) { dsu.unite(x, y); } + int startPosition(int x) { return dsu.find(x); } + + bool rightWall(int x) { return right[x]; } + bool bottomWall(int x) { return bottom[x]; } + void destroyRightWall(int x) { right[x] = false; } + void destroyBottomWall(int x) { bottom[x] = false; } + + ~Maze() { + delete[] right; + delete[] bottom; + } +}; + +int main() { + srand(time(NULL)); + + DSU dsu(7); + + dsu.print(); + std::cout << "Step: create" << std::endl; + + dsu.unite(3, 6); + + dsu.print(); + std::cout << "Step: unite(3, 6) 50/50" << std::endl; + + dsu.unite(5, 6); + + dsu.print(); + std::cout << "Step: unite(5, 6) 50/50" << std::endl; + + dsu.unite(3, 4); + + dsu.print(); + std::cout << "Step: unite(3, 4) 50/50" << std::endl; + std::cout << std::endl; + + int mazeSize = 10; + + DSU mazeDSU(mazeSize * mazeSize); + Maze maze(mazeSize * mazeSize); + + std::vector walls; + + for (int i = 0; i <= mazeSize * mazeSize * 2 - 2; i++) { + if ((i % (2 * mazeSize) == 0) || (i > mazeSize * (mazeSize - 1) * 2)) continue; + walls.push_back(i); + } + + while (walls.size() > 0) { + + int size = walls.size(); + int j = rand() % size; + int x = (walls[j] - 1) / 2; + + if (walls[j] % 2 == 0) { + if (maze.notInOnePath(x, x + 1)) { + maze.continuePath(maze.startPosition(x), maze.startPosition(x + 1)); + maze.destroyRightWall(x); + } + } + else { + if (maze.notInOnePath(x, x + mazeSize)) { + maze.continuePath(maze.startPosition(x), maze.startPosition(x + mazeSize)); + maze.destroyBottomWall(x); + } + } + walls.erase(walls.begin() + j); + } + + std::cout << " "; + for (int i = 1; i < mazeSize; i++) { + std::cout << "___"; + } + + std::cout << '\n'; + for (int i = 0; i < mazeSize; i++) { + std::cout << "|"; + for (int j = mazeSize * i; j < mazeSize + mazeSize * i; j++) { + if (j == mazeSize * mazeSize - 1) { + std::cout << " |"; + } + else if (maze.rightWall(j) && maze.bottomWall(j)) { + std::cout << "__|"; + } + else if (maze.rightWall(j)) { + std::cout << " |"; + } + else if (maze.bottomWall(j)) { + std::cout << "__ "; + } + else { + std::cout << " "; + } + } + std::cout << "\n"; + } + + return 0; +} \ No newline at end of file diff --git a/STL_Part2/.vs/STL_Part2/v17/.suo b/STL_Part2/.vs/STL_Part2/v17/.suo new file mode 100644 index 0000000..8ef8331 Binary files /dev/null and b/STL_Part2/.vs/STL_Part2/v17/.suo differ diff --git a/STL_Part2/.vs/STL_Part2/v17/Browse.VC.db b/STL_Part2/.vs/STL_Part2/v17/Browse.VC.db new file mode 100644 index 0000000..5ffbb9c Binary files /dev/null and b/STL_Part2/.vs/STL_Part2/v17/Browse.VC.db differ diff --git a/STL_Part2/.vs/STL_Part2/v17/ipch/AutoPCH/a87b86be45118aa4/MAIN.ipch b/STL_Part2/.vs/STL_Part2/v17/ipch/AutoPCH/a87b86be45118aa4/MAIN.ipch new file mode 100644 index 0000000..b3f9482 Binary files /dev/null and b/STL_Part2/.vs/STL_Part2/v17/ipch/AutoPCH/a87b86be45118aa4/MAIN.ipch differ diff --git a/STL_Part2/HomeWork1G/HomeWork1G.vcxproj b/STL_Part2/HomeWork1G/HomeWork1G.vcxproj new file mode 100644 index 0000000..7e13f5a --- /dev/null +++ b/STL_Part2/HomeWork1G/HomeWork1G.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {b15ab126-f2d9-4a85-bbe5-2ae313c76fc7} + HomeWork1G + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/STL_Part2/HomeWork1G/HomeWork1G.vcxproj.filters b/STL_Part2/HomeWork1G/HomeWork1G.vcxproj.filters new file mode 100644 index 0000000..e8deb3d --- /dev/null +++ b/STL_Part2/HomeWork1G/HomeWork1G.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/STL_Part2/HomeWork1G/HomeWork1G.vcxproj.user b/STL_Part2/HomeWork1G/HomeWork1G.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/STL_Part2/HomeWork1G/HomeWork1G.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/STL_Part2/HomeWork1G/main.cpp b/STL_Part2/HomeWork1G/main.cpp new file mode 100644 index 0000000..c43a7d4 --- /dev/null +++ b/STL_Part2/HomeWork1G/main.cpp @@ -0,0 +1,110 @@ +#include +#include +#include + +void printList(std::list basicList) { + for (auto& temp : basicList) { + std::cout << temp << " "; + } +} + + +int main(int argc, const char* argv[]){ + + srand(time(NULL)); + + std::list::iterator list_begin, list_end; + + // 1) Create empty list + std::list basicList; + std::cout << " " << std::endl; + + // 2) Add 5 element to the end of our list + std::cout << "Task 2" << std::endl; + for (int i = 0; i < 1; i++) { + for (int j = 1; j < 6; j++) { + int temp = -100 + rand() % 200; + basicList.push_back(temp); + } + } + printList(basicList); + std::cout << " " << std::endl; + + // 3) out element from begin of list + std::cout << " " << std::endl; + std::cout << "Task 3" << std::endl; + std::cout << basicList.front() << std::endl; + + // 4) Add 2 new element to begin of list + std::cout << " " << std::endl; + std::cout << "Task 4" << std::endl; + for (int i = 0; i < 2; i++) { + int temp = -100 + rand() % 200; + basicList.push_front(temp); + } + printList(basicList); + std::cout << " " << std::endl; + + // 5) delete 4's element of list + std::cout << " " << std::endl; + std::cout << "Task 5" << std::endl; + list_begin = basicList.begin(); + std::advance(list_begin, 3); + list_begin = basicList.erase(list_begin); + printList(basicList); + std::cout << " " << std::endl; + + // 6) Add 3 equal element's to the 3 random position of list + std::cout << " " << std::endl; + std::cout << "Task 6" << std::endl; + for (int i = 0; i < 3; i++) { + list_begin = basicList.begin(); + std::advance(list_begin, rand() % basicList.size()); + basicList.insert(list_begin, 11); + } + printList(basicList); + std::cout << " " << std::endl; + + // 7) delete the last element of list + std::cout << " " << std::endl; + std::cout << "Task 7" << std::endl; + basicList.pop_back(); + printList(basicList); + std::cout << " " << std::endl; + + // 8) delete first element of list + std::cout << " " << std::endl; + std::cout << "Task 8" << std::endl; + basicList.pop_front(); + printList(basicList); + std::cout << " " << std::endl; + + // 9) add 2 elements to the mid of list + std::cout << " " << std::endl; + std::cout << "Task 9" << std::endl; + list_begin = basicList.begin(); + std::advance(list_begin, basicList.size() / 2); + basicList.insert(list_begin, 2, 17); + printList(basicList); + std::cout << " " << std::endl; + + // 10) delete repeated elements + std::cout << " " << std::endl; + std::cout << "Task 10" << std::endl; + basicList.sort(); + basicList.unique(); + printList(basicList); + std::cout << " " << std::endl; + + // 11, 12) clear list + std::cout << " " << std::endl; + std::cout << "Task 11, 12" << std::endl; + basicList.clear(); + if (basicList.empty()) { + std::cout << "List successfully cleared"; + } + else { std::cout << "Error occurred while cleaning list"; } + std::cout << " " << std::endl; + + return 0; +} \ No newline at end of file diff --git a/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.exe.recipe b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.exe.recipe new file mode 100644 index 0000000..f7b7623 --- /dev/null +++ b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.exe.recipe @@ -0,0 +1,11 @@ + + + + + D:\Github\CPPlang2K\STL_Part2\x64\Debug\HomeWork1G.exe + + + + + + \ No newline at end of file diff --git a/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.ilk b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.ilk new file mode 100644 index 0000000..444be05 Binary files /dev/null and b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.ilk differ diff --git a/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.log b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.log new file mode 100644 index 0000000..e95d912 --- /dev/null +++ b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.log @@ -0,0 +1,3 @@ + main.cpp +D:\Github\CPPlang2K\STL_Part2\HomeWork1G\main.cpp(14,12): warning C4244: аргумент: преобразование "time_t" в "unsigned int", возможна потеря данных + HomeWork1G.vcxproj -> D:\Github\CPPlang2K\STL_Part2\x64\Debug\HomeWork1G.exe diff --git a/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/CL.command.1.tlog b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/CL.command.1.tlog new file mode 100644 index 0000000..a56003d Binary files /dev/null and b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/CL.command.1.tlog differ diff --git a/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/CL.read.1.tlog b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/CL.read.1.tlog new file mode 100644 index 0000000..165fd44 Binary files /dev/null and b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/CL.read.1.tlog differ diff --git a/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/CL.write.1.tlog b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/CL.write.1.tlog new file mode 100644 index 0000000..2e7dd8f Binary files /dev/null and b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/CL.write.1.tlog differ diff --git a/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/HomeWork1G.lastbuildstate b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/HomeWork1G.lastbuildstate new file mode 100644 index 0000000..141192e --- /dev/null +++ b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/HomeWork1G.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0: +Debug|x64|D:\Github\CPPlang2K\STL_Part2\| diff --git a/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/link.command.1.tlog b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/link.command.1.tlog new file mode 100644 index 0000000..dfe4041 Binary files /dev/null and b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/link.command.1.tlog differ diff --git a/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/link.read.1.tlog b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/link.read.1.tlog new file mode 100644 index 0000000..e078168 Binary files /dev/null and b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/link.read.1.tlog differ diff --git a/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/link.write.1.tlog b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/link.write.1.tlog new file mode 100644 index 0000000..4fe5b34 Binary files /dev/null and b/STL_Part2/HomeWork1G/x64/Debug/HomeWork1G.tlog/link.write.1.tlog differ diff --git a/STL_Part2/HomeWork1G/x64/Debug/main.obj b/STL_Part2/HomeWork1G/x64/Debug/main.obj new file mode 100644 index 0000000..89080c6 Binary files /dev/null and b/STL_Part2/HomeWork1G/x64/Debug/main.obj differ diff --git a/STL_Part2/HomeWork1G/x64/Debug/vc143.idb b/STL_Part2/HomeWork1G/x64/Debug/vc143.idb new file mode 100644 index 0000000..3ba2362 Binary files /dev/null and b/STL_Part2/HomeWork1G/x64/Debug/vc143.idb differ diff --git a/STL_Part2/HomeWork1G/x64/Debug/vc143.pdb b/STL_Part2/HomeWork1G/x64/Debug/vc143.pdb new file mode 100644 index 0000000..8e19fb3 Binary files /dev/null and b/STL_Part2/HomeWork1G/x64/Debug/vc143.pdb differ diff --git a/STL_Part2/STL_Part2.sln b/STL_Part2/STL_Part2.sln new file mode 100644 index 0000000..81ca877 --- /dev/null +++ b/STL_Part2/STL_Part2.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32901.215 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HomeWork1G", "HomeWork1G\HomeWork1G.vcxproj", "{B15AB126-F2D9-4A85-BBE5-2AE313C76FC7}" +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 + {B15AB126-F2D9-4A85-BBE5-2AE313C76FC7}.Debug|x64.ActiveCfg = Debug|x64 + {B15AB126-F2D9-4A85-BBE5-2AE313C76FC7}.Debug|x64.Build.0 = Debug|x64 + {B15AB126-F2D9-4A85-BBE5-2AE313C76FC7}.Debug|x86.ActiveCfg = Debug|Win32 + {B15AB126-F2D9-4A85-BBE5-2AE313C76FC7}.Debug|x86.Build.0 = Debug|Win32 + {B15AB126-F2D9-4A85-BBE5-2AE313C76FC7}.Release|x64.ActiveCfg = Release|x64 + {B15AB126-F2D9-4A85-BBE5-2AE313C76FC7}.Release|x64.Build.0 = Release|x64 + {B15AB126-F2D9-4A85-BBE5-2AE313C76FC7}.Release|x86.ActiveCfg = Release|Win32 + {B15AB126-F2D9-4A85-BBE5-2AE313C76FC7}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0C4F1493-B2C0-4BD2-BEFA-E3AD11903FDB} + EndGlobalSection +EndGlobal diff --git a/STL_Part2/x64/Debug/HomeWork1G.exe b/STL_Part2/x64/Debug/HomeWork1G.exe new file mode 100644 index 0000000..3d2bf98 Binary files /dev/null and b/STL_Part2/x64/Debug/HomeWork1G.exe differ diff --git a/STL_Part2/x64/Debug/HomeWork1G.pdb b/STL_Part2/x64/Debug/HomeWork1G.pdb new file mode 100644 index 0000000..1f81584 Binary files /dev/null and b/STL_Part2/x64/Debug/HomeWork1G.pdb differ diff --git a/STL_Part3/.vs/STL_Part3/FileContentIndex/ebbec423-a2ae-4aec-a04c-d6ce78f4fc74.vsidx b/STL_Part3/.vs/STL_Part3/FileContentIndex/ebbec423-a2ae-4aec-a04c-d6ce78f4fc74.vsidx new file mode 100644 index 0000000..3811155 Binary files /dev/null and b/STL_Part3/.vs/STL_Part3/FileContentIndex/ebbec423-a2ae-4aec-a04c-d6ce78f4fc74.vsidx differ diff --git a/STL_Part3/.vs/STL_Part3/FileContentIndex/read.lock b/STL_Part3/.vs/STL_Part3/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/STL_Part3/.vs/STL_Part3/v17/.suo b/STL_Part3/.vs/STL_Part3/v17/.suo new file mode 100644 index 0000000..6d56962 Binary files /dev/null and b/STL_Part3/.vs/STL_Part3/v17/.suo differ diff --git a/STL_Part3/.vs/STL_Part3/v17/Browse.VC.db b/STL_Part3/.vs/STL_Part3/v17/Browse.VC.db new file mode 100644 index 0000000..730526c Binary files /dev/null and b/STL_Part3/.vs/STL_Part3/v17/Browse.VC.db differ diff --git a/STL_Part3/.vs/STL_Part3/v17/ipch/AutoPCH/e84e55d8f0bfd191/MAIN.ipch b/STL_Part3/.vs/STL_Part3/v17/ipch/AutoPCH/e84e55d8f0bfd191/MAIN.ipch new file mode 100644 index 0000000..1faa5e3 Binary files /dev/null and b/STL_Part3/.vs/STL_Part3/v17/ipch/AutoPCH/e84e55d8f0bfd191/MAIN.ipch differ diff --git a/STL_Part3/HomeWork1H/HomeWork1H.vcxproj b/STL_Part3/HomeWork1H/HomeWork1H.vcxproj new file mode 100644 index 0000000..06bcec6 --- /dev/null +++ b/STL_Part3/HomeWork1H/HomeWork1H.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {5f627c43-6be9-46da-b1fe-32266c146d26} + HomeWork1H + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/STL_Part3/HomeWork1H/HomeWork1H.vcxproj.filters b/STL_Part3/HomeWork1H/HomeWork1H.vcxproj.filters new file mode 100644 index 0000000..e8deb3d --- /dev/null +++ b/STL_Part3/HomeWork1H/HomeWork1H.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/STL_Part3/HomeWork1H/HomeWork1H.vcxproj.user b/STL_Part3/HomeWork1H/HomeWork1H.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/STL_Part3/HomeWork1H/HomeWork1H.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/STL_Part3/HomeWork1H/main.cpp b/STL_Part3/HomeWork1H/main.cpp new file mode 100644 index 0000000..d329e42 --- /dev/null +++ b/STL_Part3/HomeWork1H/main.cpp @@ -0,0 +1,100 @@ +#include +#include +#include +#include + +enum Menu +{ + addElement = 1, + deleteChoosenElement = 2, + printStack = 3, + clearStack = 4, + quit = 5 +}; + +void viewStack(std::stack basicStack) { + auto view = basicStack._Get_container(); + if (basicStack.empty()) { + std::cout << "Stack is empty" << std::endl; + return; + } else { + std::cout << '\n' << "Current stack is: " << std::endl; + for (int i = basicStack.size() - 1; i >= 0; i--) { + std::cout << view[i] << std::endl; + } + } +} + +void printTaskStack(std::stack basicStack) { + std::list basicList; + if ((basicStack).empty()) { + std::cout << '\n' << "Stack is empty" << std::endl; + return; + } + while (!((basicStack).empty())) { + basicList.push_back((basicStack).top()); + (basicStack).pop(); + } + std::cout << std::endl; + for (int temp : basicList) { + printf("\t| %3d |\t\n", temp); + } + std::cout << "\t_______\t" << std::endl; + while (!basicList.empty()) { + (basicStack).push(basicList.back()); + basicList.pop_back(); + } +} + + +int main(int argc, const char* argv[]) { + + std::stack basicStack; + int user_choose; + int user_element; + int stackView; + + while (exit) { + std::cout << "What you want to do with stack? " << '\n' << "1 - Add your element to stack" << '\n' << "2 - Delete element from stack" << '\n' << "3 - Print stack" << '\n' << "4 - Clear stack" << '\n' << "5 - exit" << std::endl; + std::cin >> user_choose; + + //Menu - operations + + if (user_choose == quit) { + std::cout << '\n' << "Exit" << std::endl; + exit(5); + } + if (user_choose == addElement) { + std::cout << '\n' << "Eneter element you want to add: " << std::endl; + std::cin >> user_element; + basicStack.push(user_element); + std::cout << '\n' << "Your element successfully added to stack, do you want to see stack? 1 - Yes, 2 - No. " << std::endl; + std::cin >> stackView; + if (stackView == 1) { + viewStack(basicStack); + std::cout << std::endl; + } + else { std::cout << '\n' << "Back to the Menu" << std::endl; } + } + if (user_choose == deleteChoosenElement) { + std::cout << "Deleting last added element from stack.." << std::endl; + basicStack.pop(); + std::cout << '\n' << "Element successfully deleted to stack, do you want to see stack? 1 - Yes, 2 - No. " << std::endl; + std::cin >> stackView; + if (stackView == 1) { + viewStack(basicStack); + std::cout << std::endl; + } + else { std::cout << '\n' << "Back to the Menu" << std::endl; } + } + if (user_choose == printStack) { + printTaskStack(basicStack); + } + if (user_choose == clearStack) { + while (!basicStack.empty()) { + basicStack.pop(); + } + std::cout << "Stack successfully cleared" << std::endl; + } + } +} \ No newline at end of file diff --git a/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.exe.recipe b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.exe.recipe new file mode 100644 index 0000000..eb2b474 --- /dev/null +++ b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.exe.recipe @@ -0,0 +1,11 @@ + + + + + D:\Github\CPPlang2K\STL_Part3\x64\Debug\HomeWork1H.exe + + + + + + \ No newline at end of file diff --git a/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.ilk b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.ilk new file mode 100644 index 0000000..0ac4b31 Binary files /dev/null and b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.ilk differ diff --git a/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.log b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.log new file mode 100644 index 0000000..438e01b --- /dev/null +++ b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.log @@ -0,0 +1,4 @@ + main.cpp +D:\Github\CPPlang2K\STL_Part3\HomeWork1H\main.cpp(22,3): warning C4267: инициализация: преобразование из "size_t" в "int"; возможна потеря данных +D:\Github\CPPlang2K\STL_Part3\HomeWork1H\main.cpp(57,9): warning C4551: в вызове функции отсутствует список аргументов + HomeWork1H.vcxproj -> D:\Github\CPPlang2K\STL_Part3\x64\Debug\HomeWork1H.exe diff --git a/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.command.1.tlog b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.command.1.tlog new file mode 100644 index 0000000..d8d07de Binary files /dev/null and b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.command.1.tlog differ diff --git a/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.read.1.tlog b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.read.1.tlog new file mode 100644 index 0000000..60bc890 Binary files /dev/null and b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.read.1.tlog differ diff --git a/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.write.1.tlog b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.write.1.tlog new file mode 100644 index 0000000..3a2ce63 Binary files /dev/null and b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.write.1.tlog differ diff --git a/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/HomeWork1H.lastbuildstate b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/HomeWork1H.lastbuildstate new file mode 100644 index 0000000..c7ea28f --- /dev/null +++ b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/HomeWork1H.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0: +Debug|x64|D:\Github\CPPlang2K\STL_Part3\| diff --git a/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.command.1.tlog b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.command.1.tlog new file mode 100644 index 0000000..6fc9f41 Binary files /dev/null and b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.command.1.tlog differ diff --git a/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.read.1.tlog b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.read.1.tlog new file mode 100644 index 0000000..3373d97 Binary files /dev/null and b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.read.1.tlog differ diff --git a/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.write.1.tlog b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.write.1.tlog new file mode 100644 index 0000000..fed5a16 Binary files /dev/null and b/STL_Part3/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.write.1.tlog differ diff --git a/STL_Part3/HomeWork1H/x64/Debug/main.obj b/STL_Part3/HomeWork1H/x64/Debug/main.obj new file mode 100644 index 0000000..aef5fbb Binary files /dev/null and b/STL_Part3/HomeWork1H/x64/Debug/main.obj differ diff --git a/STL_Part3/HomeWork1H/x64/Debug/vc143.idb b/STL_Part3/HomeWork1H/x64/Debug/vc143.idb new file mode 100644 index 0000000..8dfe067 Binary files /dev/null and b/STL_Part3/HomeWork1H/x64/Debug/vc143.idb differ diff --git a/STL_Part3/HomeWork1H/x64/Debug/vc143.pdb b/STL_Part3/HomeWork1H/x64/Debug/vc143.pdb new file mode 100644 index 0000000..9ff84c7 Binary files /dev/null and b/STL_Part3/HomeWork1H/x64/Debug/vc143.pdb differ diff --git a/STL_Part3/STL_Part3.sln b/STL_Part3/STL_Part3.sln new file mode 100644 index 0000000..d783cff --- /dev/null +++ b/STL_Part3/STL_Part3.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32901.215 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HomeWork1H", "HomeWork1H\HomeWork1H.vcxproj", "{5F627C43-6BE9-46DA-B1FE-32266C146D26}" +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 + {5F627C43-6BE9-46DA-B1FE-32266C146D26}.Debug|x64.ActiveCfg = Debug|x64 + {5F627C43-6BE9-46DA-B1FE-32266C146D26}.Debug|x64.Build.0 = Debug|x64 + {5F627C43-6BE9-46DA-B1FE-32266C146D26}.Debug|x86.ActiveCfg = Debug|Win32 + {5F627C43-6BE9-46DA-B1FE-32266C146D26}.Debug|x86.Build.0 = Debug|Win32 + {5F627C43-6BE9-46DA-B1FE-32266C146D26}.Release|x64.ActiveCfg = Release|x64 + {5F627C43-6BE9-46DA-B1FE-32266C146D26}.Release|x64.Build.0 = Release|x64 + {5F627C43-6BE9-46DA-B1FE-32266C146D26}.Release|x86.ActiveCfg = Release|Win32 + {5F627C43-6BE9-46DA-B1FE-32266C146D26}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3F84D175-6861-4E2C-B290-52E03A351491} + EndGlobalSection +EndGlobal diff --git a/STL_Part3/x64/Debug/HomeWork1H.exe b/STL_Part3/x64/Debug/HomeWork1H.exe new file mode 100644 index 0000000..44fda09 Binary files /dev/null and b/STL_Part3/x64/Debug/HomeWork1H.exe differ diff --git a/STL_Part3/x64/Debug/HomeWork1H.pdb b/STL_Part3/x64/Debug/HomeWork1H.pdb new file mode 100644 index 0000000..5d8e2e7 Binary files /dev/null and b/STL_Part3/x64/Debug/HomeWork1H.pdb differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/FileContentIndex/b2afd994-a89a-400b-a51b-8cec063d6824.vsidx b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/FileContentIndex/b2afd994-a89a-400b-a51b-8cec063d6824.vsidx new file mode 100644 index 0000000..9cc3442 Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/FileContentIndex/b2afd994-a89a-400b-a51b-8cec063d6824.vsidx differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/FileContentIndex/fbad7755-3d3a-4e66-995f-845e59eea4b4.vsidx b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/FileContentIndex/fbad7755-3d3a-4e66-995f-845e59eea4b4.vsidx new file mode 100644 index 0000000..70f19d4 Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/FileContentIndex/fbad7755-3d3a-4e66-995f-845e59eea4b4.vsidx differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/FileContentIndex/read.lock b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/.suo b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/.suo new file mode 100644 index 0000000..cde19b8 Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/.suo differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/Browse.VC.db b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/Browse.VC.db new file mode 100644 index 0000000..d4fee6d Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/Browse.VC.db differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/2d53689edff661ab/MAIN.ipch b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/2d53689edff661ab/MAIN.ipch new file mode 100644 index 0000000..6538d12 Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/2d53689edff661ab/MAIN.ipch differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/2ff1ad80e8226d59/SYNTAXTREE.ipch b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/2ff1ad80e8226d59/SYNTAXTREE.ipch new file mode 100644 index 0000000..00453d6 Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/2ff1ad80e8226d59/SYNTAXTREE.ipch differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/619a8a1f57220ee1/SYNTAXTREE.ipch b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/619a8a1f57220ee1/SYNTAXTREE.ipch new file mode 100644 index 0000000..c188be4 Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/619a8a1f57220ee1/SYNTAXTREE.ipch differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/66c6c5a9b99b8edb/MAIN.ipch b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/66c6c5a9b99b8edb/MAIN.ipch new file mode 100644 index 0000000..7925a3f Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/66c6c5a9b99b8edb/MAIN.ipch differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/8160c65403f5a146/NODE.ipch b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/8160c65403f5a146/NODE.ipch new file mode 100644 index 0000000..c420ab1 Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/8160c65403f5a146/NODE.ipch differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/8b24c119a4858ece/NODE.ipch b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/8b24c119a4858ece/NODE.ipch new file mode 100644 index 0000000..6661b45 Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/8b24c119a4858ece/NODE.ipch differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/974c5faac3b58631/SYNTAXTREE.ipch b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/974c5faac3b58631/SYNTAXTREE.ipch new file mode 100644 index 0000000..ac4d265 Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/974c5faac3b58631/SYNTAXTREE.ipch differ diff --git a/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/c5bb46b8d66de213/MAIN.ipch b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/c5bb46b8d66de213/MAIN.ipch new file mode 100644 index 0000000..8fe8654 Binary files /dev/null and b/SyntaxTree/.vs/SyntaxTree-and-BinarySearchTree/v17/ipch/AutoPCH/c5bb46b8d66de213/MAIN.ipch differ diff --git a/SyntaxTree/Node.cpp b/SyntaxTree/Node.cpp new file mode 100644 index 0000000..419ffb5 --- /dev/null +++ b/SyntaxTree/Node.cpp @@ -0,0 +1,16 @@ +#include + +class Node { +public: + std::string value; + Node* left; + Node* right; + + Node() noexcept { + left = nullptr; + right = nullptr; + } + Node(std::string value) noexcept { + this->value = value; + } +}; \ No newline at end of file diff --git a/SyntaxTree/SyntaxTree-and-BinarySearchTree.sln b/SyntaxTree/SyntaxTree-and-BinarySearchTree.sln new file mode 100644 index 0000000..df2712f --- /dev/null +++ b/SyntaxTree/SyntaxTree-and-BinarySearchTree.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32825.248 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SyntaxTree-and-BinarySearchTree", "SyntaxTree-and-BinarySearchTree.vcxproj", "{72B6D53A-2067-45A5-9DF5-299F1EC3FB58}" +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 + {72B6D53A-2067-45A5-9DF5-299F1EC3FB58}.Debug|x64.ActiveCfg = Debug|x64 + {72B6D53A-2067-45A5-9DF5-299F1EC3FB58}.Debug|x64.Build.0 = Debug|x64 + {72B6D53A-2067-45A5-9DF5-299F1EC3FB58}.Debug|x86.ActiveCfg = Debug|Win32 + {72B6D53A-2067-45A5-9DF5-299F1EC3FB58}.Debug|x86.Build.0 = Debug|Win32 + {72B6D53A-2067-45A5-9DF5-299F1EC3FB58}.Release|x64.ActiveCfg = Release|x64 + {72B6D53A-2067-45A5-9DF5-299F1EC3FB58}.Release|x64.Build.0 = Release|x64 + {72B6D53A-2067-45A5-9DF5-299F1EC3FB58}.Release|x86.ActiveCfg = Release|Win32 + {72B6D53A-2067-45A5-9DF5-299F1EC3FB58}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7008B1AD-8D29-49D7-9485-7BAB6CE61CAF} + EndGlobalSection +EndGlobal diff --git a/SyntaxTree/SyntaxTree-and-BinarySearchTree.vcxproj b/SyntaxTree/SyntaxTree-and-BinarySearchTree.vcxproj new file mode 100644 index 0000000..5ac3d4c --- /dev/null +++ b/SyntaxTree/SyntaxTree-and-BinarySearchTree.vcxproj @@ -0,0 +1,137 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {72b6d53a-2067-45a5-9df5-299f1ec3fb58} + SyntaxTreeandBinarySearchTree + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + \ No newline at end of file diff --git a/SyntaxTree/SyntaxTree-and-BinarySearchTree.vcxproj.filters b/SyntaxTree/SyntaxTree-and-BinarySearchTree.vcxproj.filters new file mode 100644 index 0000000..59017e3 --- /dev/null +++ b/SyntaxTree/SyntaxTree-and-BinarySearchTree.vcxproj.filters @@ -0,0 +1,28 @@ + + + + + {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/SyntaxTree/SyntaxTree-and-BinarySearchTree.vcxproj.user b/SyntaxTree/SyntaxTree-and-BinarySearchTree.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/SyntaxTree/SyntaxTree-and-BinarySearchTree.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/SyntaxTree/SyntaxTree.cpp b/SyntaxTree/SyntaxTree.cpp new file mode 100644 index 0000000..a2ab774 --- /dev/null +++ b/SyntaxTree/SyntaxTree.cpp @@ -0,0 +1,75 @@ +#include "Node.cpp" +class SyntaxTree { +private : + + std::string operations = "+-*"; + bool isValueAnOperation(std::string value) { + if (value.size() > 1) return false; + if (value[0] >= '0' && value[0] <= '9') return false; + return true; + } + + Node* insertNode(Node* node, std::string value) { + if (node == nullptr) { + return new Node(value); + } + + if (node->right == nullptr) { + node->right = insertNode(node->right, value); + } + else if (node->left == nullptr) { + node->left = insertNode(node->left, value); + } + else if (isValueAnOperation(node->right->value)) { + node->right = insertNode(node->right, value); + } + else if (isValueAnOperation(node->left->value)) { + node->left = insertNode(node->left, value); + } + + return node; + } + double evaluateNode(Node* node) { + if (node->left == nullptr && node->right == nullptr) { + return std::stod(node->value); + } + + double leftValue = evaluateNode(node->left); + double rightValue = evaluateNode(node->right); + + if (node->value == "+") { + return leftValue + rightValue; + } + else if (node->value == "-") { + return leftValue - rightValue; + } + else if (node->value == "*") { + return leftValue * rightValue; + } + + + return 0; + } + +public: + Node* root; + Node* treeRoot; + SyntaxTree() { + root = nullptr; + } + + SyntaxTree(Node* root) { + this->root = root; + } + + void insert(const std::string& value) { + root = insertNode(root, value); + if (treeRoot == nullptr) + treeRoot = root; + } + + double evaluate() { + return evaluateNode(treeRoot); + } + +}; \ No newline at end of file diff --git a/SyntaxTree/main.cpp b/SyntaxTree/main.cpp new file mode 100644 index 0000000..8c7e1c6 --- /dev/null +++ b/SyntaxTree/main.cpp @@ -0,0 +1,13 @@ +#include "SyntaxTree.cpp" +#include + +int main() { + SyntaxTree tree; + tree.insert("+"); + tree.insert("5"); + tree.insert("*"); + tree.insert("10"); + tree.insert("20"); + std::cout << tree.evaluate(); + return 0; +} \ No newline at end of file diff --git a/TaskITC3/.vs/STL_Part1/FileContentIndex/134e5000-fa6e-46a6-925b-6bc50f5f5df1.vsidx b/TaskITC3/.vs/STL_Part1/FileContentIndex/134e5000-fa6e-46a6-925b-6bc50f5f5df1.vsidx new file mode 100644 index 0000000..950bf67 Binary files /dev/null and b/TaskITC3/.vs/STL_Part1/FileContentIndex/134e5000-fa6e-46a6-925b-6bc50f5f5df1.vsidx differ diff --git a/TaskITC3/.vs/STL_Part1/FileContentIndex/820505ba-0b58-4cdf-aecc-10b8e38f677f.vsidx b/TaskITC3/.vs/STL_Part1/FileContentIndex/820505ba-0b58-4cdf-aecc-10b8e38f677f.vsidx new file mode 100644 index 0000000..6f495e2 Binary files /dev/null and b/TaskITC3/.vs/STL_Part1/FileContentIndex/820505ba-0b58-4cdf-aecc-10b8e38f677f.vsidx differ diff --git a/TaskITC3/.vs/STL_Part1/FileContentIndex/886bb9b9-d2f0-4075-a86b-5a84290bec02.vsidx b/TaskITC3/.vs/STL_Part1/FileContentIndex/886bb9b9-d2f0-4075-a86b-5a84290bec02.vsidx new file mode 100644 index 0000000..f8be0db Binary files /dev/null and b/TaskITC3/.vs/STL_Part1/FileContentIndex/886bb9b9-d2f0-4075-a86b-5a84290bec02.vsidx differ diff --git a/TaskITC3/.vs/STL_Part1/FileContentIndex/read.lock b/TaskITC3/.vs/STL_Part1/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/TaskITC3/.vs/STL_Part1/v17/.suo b/TaskITC3/.vs/STL_Part1/v17/.suo new file mode 100644 index 0000000..301f36f Binary files /dev/null and b/TaskITC3/.vs/STL_Part1/v17/.suo differ diff --git a/TaskITC3/.vs/STL_Part1/v17/Browse.VC.db b/TaskITC3/.vs/STL_Part1/v17/Browse.VC.db new file mode 100644 index 0000000..66fb8a0 Binary files /dev/null and b/TaskITC3/.vs/STL_Part1/v17/Browse.VC.db differ diff --git a/TaskITC3/.vs/STL_Part1/v17/ipch/AutoPCH/626d25fe955b1898/MAIN.ipch b/TaskITC3/.vs/STL_Part1/v17/ipch/AutoPCH/626d25fe955b1898/MAIN.ipch new file mode 100644 index 0000000..78769cc Binary files /dev/null and b/TaskITC3/.vs/STL_Part1/v17/ipch/AutoPCH/626d25fe955b1898/MAIN.ipch differ diff --git a/TaskITC3/.vs/STL_Part1/v17/ipch/AutoPCH/c2ee7944fbb4b570/MAIN2.ipch b/TaskITC3/.vs/STL_Part1/v17/ipch/AutoPCH/c2ee7944fbb4b570/MAIN2.ipch new file mode 100644 index 0000000..ea30fb3 Binary files /dev/null and b/TaskITC3/.vs/STL_Part1/v17/ipch/AutoPCH/c2ee7944fbb4b570/MAIN2.ipch differ diff --git a/TaskITC3/.vs/TaskITC3/FileContentIndex/4db3c877-7247-4fa2-b9bd-a2e71758b891.vsidx b/TaskITC3/.vs/TaskITC3/FileContentIndex/4db3c877-7247-4fa2-b9bd-a2e71758b891.vsidx new file mode 100644 index 0000000..80d077c Binary files /dev/null and b/TaskITC3/.vs/TaskITC3/FileContentIndex/4db3c877-7247-4fa2-b9bd-a2e71758b891.vsidx differ diff --git a/TaskITC3/.vs/TaskITC3/FileContentIndex/7cc85201-0ea0-4f08-bb76-4dddeec0458d.vsidx b/TaskITC3/.vs/TaskITC3/FileContentIndex/7cc85201-0ea0-4f08-bb76-4dddeec0458d.vsidx new file mode 100644 index 0000000..784e15f Binary files /dev/null and b/TaskITC3/.vs/TaskITC3/FileContentIndex/7cc85201-0ea0-4f08-bb76-4dddeec0458d.vsidx differ diff --git a/TaskITC3/.vs/TaskITC3/FileContentIndex/read.lock b/TaskITC3/.vs/TaskITC3/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/TaskITC3/STL_Part1.sln b/TaskITC3/STL_Part1.sln new file mode 100644 index 0000000..8f4c574 --- /dev/null +++ b/TaskITC3/STL_Part1.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32901.215 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TaskITC3", "TaskITC3\TaskITC3.vcxproj", "{A1B3CAC9-DF6C-4731-BDF4-619DCF410295}" +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 + {A1B3CAC9-DF6C-4731-BDF4-619DCF410295}.Debug|x64.ActiveCfg = Debug|x64 + {A1B3CAC9-DF6C-4731-BDF4-619DCF410295}.Debug|x64.Build.0 = Debug|x64 + {A1B3CAC9-DF6C-4731-BDF4-619DCF410295}.Debug|x86.ActiveCfg = Debug|Win32 + {A1B3CAC9-DF6C-4731-BDF4-619DCF410295}.Debug|x86.Build.0 = Debug|Win32 + {A1B3CAC9-DF6C-4731-BDF4-619DCF410295}.Release|x64.ActiveCfg = Release|x64 + {A1B3CAC9-DF6C-4731-BDF4-619DCF410295}.Release|x64.Build.0 = Release|x64 + {A1B3CAC9-DF6C-4731-BDF4-619DCF410295}.Release|x86.ActiveCfg = Release|Win32 + {A1B3CAC9-DF6C-4731-BDF4-619DCF410295}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E8E09526-CFB9-4CED-A5D7-FE821C7D310A} + EndGlobalSection +EndGlobal diff --git a/TaskITC3/TaskITC3/TaskITC3.vcxproj b/TaskITC3/TaskITC3/TaskITC3.vcxproj new file mode 100644 index 0000000..8421d41 --- /dev/null +++ b/TaskITC3/TaskITC3/TaskITC3.vcxproj @@ -0,0 +1,136 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {a1b3cac9-df6c-4731-bdf4-619dcf410295} + TaskITC3 + 10.0 + HomeWork1G + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/TaskITC3/TaskITC3/TaskITC3.vcxproj.filters b/TaskITC3/TaskITC3/TaskITC3.vcxproj.filters new file mode 100644 index 0000000..e8deb3d --- /dev/null +++ b/TaskITC3/TaskITC3/TaskITC3.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/TaskITC3/TaskITC3/TaskITC3.vcxproj.user b/TaskITC3/TaskITC3/TaskITC3.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/TaskITC3/TaskITC3/TaskITC3.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/TaskITC3/TaskITC3/main.cpp b/TaskITC3/TaskITC3/main.cpp new file mode 100644 index 0000000..98c763a --- /dev/null +++ b/TaskITC3/TaskITC3/main.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include + +void vecPrint(std::vector fVector) { + for (auto& temp : fVector) { + std::cout << temp << " "; + } + std::cout << std::endl; +} + +int main(int argc, const char* argv) { + + srand(time(0)); + + std::cout << "Hello!" << std::endl; + + std::vector fVector(20); + + // 1) Fill vect. = 0 + + std::cout << "Task 1" << std::endl; + for (int i = 0; i < 20; i++) { + std::cout << fVector[i] << " "; + } + std::cout << "" << std::endl; + + // 2) Fill vect. = rand ( -100 <> 100 ) + + std::cout << "" << std::endl; + std::cout << "Task 2" << std::endl; + for (int i = 0; i < 20; i++) { + fVector[i] = -100 + rand() % (100 - (-100) + 1); + std::cout << fVector[i] << " "; + } + std::cout << "" << std::endl; + + // 3) Min Max elem. + + std::cout << "" << std::endl; + std::cout << "Task 3" << std::endl; + std::cout << "Min Element = " << *min_element(fVector.begin(), fVector.end()) << std::endl; + std::cout << "Max Element = " << *max_element(fVector.begin(), fVector.end()) << std::endl; + + // 4) Sort vect. + + std::cout << "" << std::endl; + std::cout << "Task 4" << std::endl; + std::sort(fVector.begin(), fVector.end()); + for (const auto& i : fVector) { + std::cout << i << ' '; + } + std::cout << "" << std::endl; + + // 5) Adding 4 new elem. to vect.end + + std::cout << "" << std::endl; + std::cout << "Task 5" << std::endl; + fVector.insert(fVector.end(), { 11, 13, -15, -17 }); + for (int i = 0; i < fVector.size(); i++) { + std::cout << fVector[i] << " "; + } + std::cout << "" << std::endl; + + // 6) If elem < 10 then elem = 0 + + std::cout << "" << std::endl; + std::cout << "Task 6" << std::endl; + for (int i = 0; i < fVector.size(); i++) { + if (fVector[i] < 10) { + fVector[i] = 0; + } + std::cout << fVector[i] << " "; + } + std::cout << "" << std::endl; + + // 7) If fvec[i] > 20 then output it + + std::cout << "" << std::endl; + std::cout << "Task 7" << std::endl; + std::cout << "Elements > 20 : "; + for (int i = 0; i < fVector.size(); i++) { + if (fVector[i] > 20) { + int temp; + temp = fVector[i]; + std::cout << temp << " "; + } + } + std::cout << "" << std::endl; + + // 8) if fvec[i] / 2 = 0 then fvec[i] * 3 + + std::cout << "" << std::endl; + std::cout << "Task 8" << std::endl; + for (int i = 0; i < fVector.size(); i++) { + if (fVector[i] % 2 == 0) { + fVector[i] = fVector[i] * 3; + } + std::cout << fVector[i] << " "; + } + std::cout << "" << std::endl; + + // 9) random shuffled elements + + std::cout << "" << std::endl; + std::cout << "Task 9" << std::endl; + std::random_shuffle(fVector.begin(), fVector.end()); + vecPrint(fVector); + std::cout << "" << std::endl; + + // 10) if fvec[i] > 50 then del fvec[i] + + std::cout << "" << std::endl; + std::cout << "Task 10" << std::endl; + bool flag = true; + while (flag == true) { + for (auto iterator = begin(fVector); iterator != end(fVector); ++iterator) { + flag = false; + if (*iterator > 50) { + fVector.erase(iterator); + flag = true; + break; + } + } + } + vecPrint(fVector); + std::cout << "" << std::endl; + + // 11) Print count of elements, if fvec[i] % 2 == 0 - del fvec[i], else reverse fvec + + std::cout << "" << std::endl; + std::cout << "Task 11" << std::endl; + if (fVector.size() % 2 != 0) { + fVector.erase(fVector.begin() + fVector.size() - 1); + vecPrint(fVector); + } + else { + for (auto iterator = fVector.rbegin(); iterator != fVector.rend(); ++iterator) { + std::cout << *iterator << " "; + } + } + std::cout << "" << std::endl; + + // 12) Clear vector (with message) + + std::cout << "" << std::endl; + std::cout << "Task 12" << std::endl; + fVector.clear(); + if (fVector.size() == 0) { + std::cout << "Vector successfully cleared"; + } + else { std::cout << "Error occurred while cleaning vector"; } + std::cout << "" << std::endl; + + return 0; +} \ No newline at end of file diff --git a/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.exe.recipe b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.exe.recipe new file mode 100644 index 0000000..32b9a27 --- /dev/null +++ b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.exe.recipe @@ -0,0 +1,11 @@ + + + + + D:\Github\CPPlang2K\TaskITC3\x64\Debug\HomeWork1G.exe + + + + + + \ No newline at end of file diff --git a/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.ilk b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.ilk new file mode 100644 index 0000000..d8ff3bb Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.ilk differ diff --git a/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/CL.command.1.tlog b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/CL.command.1.tlog new file mode 100644 index 0000000..e16dd7b Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/CL.command.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/CL.read.1.tlog b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/CL.read.1.tlog new file mode 100644 index 0000000..09b1711 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/CL.read.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/CL.write.1.tlog b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/CL.write.1.tlog new file mode 100644 index 0000000..de0bbc0 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/CL.write.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/HomeWork1G.lastbuildstate b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/HomeWork1G.lastbuildstate new file mode 100644 index 0000000..754b174 --- /dev/null +++ b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/HomeWork1G.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0: +Debug|x64|D:\Github\CPPlang2K\TaskITC3\| diff --git a/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/link.command.1.tlog b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/link.command.1.tlog new file mode 100644 index 0000000..a8a58d6 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/link.command.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/link.read.1.tlog b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/link.read.1.tlog new file mode 100644 index 0000000..f0a3d5c Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/link.read.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/link.write.1.tlog b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/link.write.1.tlog new file mode 100644 index 0000000..b8a76d4 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/HomeWork1G.tlog/link.write.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/TaskITC3.exe.recipe b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.exe.recipe new file mode 100644 index 0000000..2531e42 --- /dev/null +++ b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.exe.recipe @@ -0,0 +1,11 @@ + + + + + D:\Github\CPPlang2K\TaskITC3\x64\Debug\TaskITC3.exe + + + + + + \ No newline at end of file diff --git a/TaskITC3/TaskITC3/x64/Debug/TaskITC3.ilk b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.ilk new file mode 100644 index 0000000..e75c521 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.ilk differ diff --git a/TaskITC3/TaskITC3/x64/Debug/TaskITC3.log b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.log new file mode 100644 index 0000000..b40933b --- /dev/null +++ b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.log @@ -0,0 +1,4 @@ +C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(534,5): warning MSB8028: промежуточный каталог (x64\Debug\) содержит файлы, которые используются совместно с другим проектом (TaskITC3.vcxproj). Это может привести к ошибкам очистки и перестроения. + main.cpp +D:\Github\CPPlang2K\TaskITC3\TaskITC3\main.cpp(16,12): warning C4244: аргумент: преобразование "time_t" в "unsigned int", возможна потеря данных + TaskITC3.vcxproj -> D:\Github\CPPlang2K\TaskITC3\x64\Debug\HomeWork1G.exe diff --git a/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/CL.command.1.tlog b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/CL.command.1.tlog new file mode 100644 index 0000000..2257063 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/CL.command.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/CL.read.1.tlog b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/CL.read.1.tlog new file mode 100644 index 0000000..09b1711 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/CL.read.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/CL.write.1.tlog b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/CL.write.1.tlog new file mode 100644 index 0000000..de0bbc0 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/CL.write.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/TaskITC3.lastbuildstate b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/TaskITC3.lastbuildstate new file mode 100644 index 0000000..754b174 --- /dev/null +++ b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/TaskITC3.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0: +Debug|x64|D:\Github\CPPlang2K\TaskITC3\| diff --git a/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/link.command.1.tlog b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/link.command.1.tlog new file mode 100644 index 0000000..5bce3ab Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/link.command.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/link.read.1.tlog b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/link.read.1.tlog new file mode 100644 index 0000000..b081730 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/link.read.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/link.write.1.tlog b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/link.write.1.tlog new file mode 100644 index 0000000..01bb2d0 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/TaskITC3.tlog/link.write.1.tlog differ diff --git a/TaskITC3/TaskITC3/x64/Debug/main.obj b/TaskITC3/TaskITC3/x64/Debug/main.obj new file mode 100644 index 0000000..d231c40 Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/main.obj differ diff --git a/TaskITC3/TaskITC3/x64/Debug/main2.obj b/TaskITC3/TaskITC3/x64/Debug/main2.obj new file mode 100644 index 0000000..f1a812d Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/main2.obj differ diff --git a/TaskITC3/TaskITC3/x64/Debug/vc143.idb b/TaskITC3/TaskITC3/x64/Debug/vc143.idb new file mode 100644 index 0000000..63baa6a Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/vc143.idb differ diff --git a/TaskITC3/TaskITC3/x64/Debug/vc143.pdb b/TaskITC3/TaskITC3/x64/Debug/vc143.pdb new file mode 100644 index 0000000..74b50eb Binary files /dev/null and b/TaskITC3/TaskITC3/x64/Debug/vc143.pdb differ diff --git a/TaskITC3/x64/Debug/HomeWork1G.exe b/TaskITC3/x64/Debug/HomeWork1G.exe new file mode 100644 index 0000000..bdae159 Binary files /dev/null and b/TaskITC3/x64/Debug/HomeWork1G.exe differ diff --git a/TaskITC3/x64/Debug/HomeWork1G.pdb b/TaskITC3/x64/Debug/HomeWork1G.pdb new file mode 100644 index 0000000..f9beccb Binary files /dev/null and b/TaskITC3/x64/Debug/HomeWork1G.pdb differ diff --git a/TaskITC3/x64/Debug/TaskITC3.exe b/TaskITC3/x64/Debug/TaskITC3.exe new file mode 100644 index 0000000..3cb06df Binary files /dev/null and b/TaskITC3/x64/Debug/TaskITC3.exe differ diff --git a/TaskITC3/x64/Debug/TaskITC3.pdb b/TaskITC3/x64/Debug/TaskITC3.pdb new file mode 100644 index 0000000..40cc561 Binary files /dev/null and b/TaskITC3/x64/Debug/TaskITC3.pdb differ diff --git a/Test b/Test deleted file mode 100644 index 8b13789..0000000 --- a/Test +++ /dev/null @@ -1 +0,0 @@ - diff --git a/TreeProject/.vs/TreeProject/FileContentIndex/172a3a1f-6919-4702-be8c-ef7ebf654a02.vsidx b/TreeProject/.vs/TreeProject/FileContentIndex/172a3a1f-6919-4702-be8c-ef7ebf654a02.vsidx new file mode 100644 index 0000000..c3c2872 Binary files /dev/null and b/TreeProject/.vs/TreeProject/FileContentIndex/172a3a1f-6919-4702-be8c-ef7ebf654a02.vsidx differ diff --git a/TreeProject/.vs/TreeProject/FileContentIndex/c5c65bd2-e33b-4aa6-a3ee-c4a6bca4bb49.vsidx b/TreeProject/.vs/TreeProject/FileContentIndex/c5c65bd2-e33b-4aa6-a3ee-c4a6bca4bb49.vsidx new file mode 100644 index 0000000..30067f6 Binary files /dev/null and b/TreeProject/.vs/TreeProject/FileContentIndex/c5c65bd2-e33b-4aa6-a3ee-c4a6bca4bb49.vsidx differ diff --git a/TreeProject/.vs/TreeProject/FileContentIndex/eefcb419-3949-4422-9a36-0ce6fb638c3a.vsidx b/TreeProject/.vs/TreeProject/FileContentIndex/eefcb419-3949-4422-9a36-0ce6fb638c3a.vsidx new file mode 100644 index 0000000..e6339cc Binary files /dev/null and b/TreeProject/.vs/TreeProject/FileContentIndex/eefcb419-3949-4422-9a36-0ce6fb638c3a.vsidx differ diff --git a/TreeProject/.vs/TreeProject/FileContentIndex/f858460b-aa4a-43e5-83db-54ccfe2fd0c4.vsidx b/TreeProject/.vs/TreeProject/FileContentIndex/f858460b-aa4a-43e5-83db-54ccfe2fd0c4.vsidx new file mode 100644 index 0000000..8085c02 Binary files /dev/null and b/TreeProject/.vs/TreeProject/FileContentIndex/f858460b-aa4a-43e5-83db-54ccfe2fd0c4.vsidx differ diff --git a/TreeProject/.vs/TreeProject/FileContentIndex/read.lock b/TreeProject/.vs/TreeProject/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/TreeProject/.vs/TreeProject/v17/.suo b/TreeProject/.vs/TreeProject/v17/.suo new file mode 100644 index 0000000..43c68e1 Binary files /dev/null and b/TreeProject/.vs/TreeProject/v17/.suo differ diff --git a/TreeProject/.vs/TreeProject/v17/Browse.VC.db b/TreeProject/.vs/TreeProject/v17/Browse.VC.db new file mode 100644 index 0000000..1d2987f Binary files /dev/null and b/TreeProject/.vs/TreeProject/v17/Browse.VC.db differ diff --git a/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/480d9ff76419a6a5/BINARYSEARCHTREE.ipch b/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/480d9ff76419a6a5/BINARYSEARCHTREE.ipch new file mode 100644 index 0000000..9f2adba Binary files /dev/null and b/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/480d9ff76419a6a5/BINARYSEARCHTREE.ipch differ diff --git a/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/615cf229be985c2c/BRANCH.ipch b/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/615cf229be985c2c/BRANCH.ipch new file mode 100644 index 0000000..025b6b8 Binary files /dev/null and b/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/615cf229be985c2c/BRANCH.ipch differ diff --git a/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/6e139815187d974/NODE.ipch b/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/6e139815187d974/NODE.ipch new file mode 100644 index 0000000..aec243e Binary files /dev/null and b/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/6e139815187d974/NODE.ipch differ diff --git a/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/6ea3b0159f4b72fb/SYNTAXTREE.ipch b/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/6ea3b0159f4b72fb/SYNTAXTREE.ipch new file mode 100644 index 0000000..0449ff3 Binary files /dev/null and b/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/6ea3b0159f4b72fb/SYNTAXTREE.ipch differ diff --git a/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/eeaea3cd0e257215/MAIN.ipch b/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/eeaea3cd0e257215/MAIN.ipch new file mode 100644 index 0000000..427f6ae Binary files /dev/null and b/TreeProject/.vs/TreeProject/v17/ipch/AutoPCH/eeaea3cd0e257215/MAIN.ipch differ diff --git a/TreeProject/TreeProject.sln b/TreeProject/TreeProject.sln new file mode 100644 index 0000000..6b21d32 --- /dev/null +++ b/TreeProject/TreeProject.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33516.290 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TreeProject", "TreeProject\TreeProject.vcxproj", "{D656B510-E9F0-4A22-B040-47F4174D8B29}" +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 + {D656B510-E9F0-4A22-B040-47F4174D8B29}.Debug|x64.ActiveCfg = Debug|x64 + {D656B510-E9F0-4A22-B040-47F4174D8B29}.Debug|x64.Build.0 = Debug|x64 + {D656B510-E9F0-4A22-B040-47F4174D8B29}.Debug|x86.ActiveCfg = Debug|Win32 + {D656B510-E9F0-4A22-B040-47F4174D8B29}.Debug|x86.Build.0 = Debug|Win32 + {D656B510-E9F0-4A22-B040-47F4174D8B29}.Release|x64.ActiveCfg = Release|x64 + {D656B510-E9F0-4A22-B040-47F4174D8B29}.Release|x64.Build.0 = Release|x64 + {D656B510-E9F0-4A22-B040-47F4174D8B29}.Release|x86.ActiveCfg = Release|Win32 + {D656B510-E9F0-4A22-B040-47F4174D8B29}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {88B5ABF7-BAB6-4E0F-9704-34A6B38EB9CE} + EndGlobalSection +EndGlobal diff --git a/TreeProject/TreeProject/BinarySearchTree.cpp b/TreeProject/TreeProject/BinarySearchTree.cpp new file mode 100644 index 0000000..2cfd921 --- /dev/null +++ b/TreeProject/TreeProject/BinarySearchTree.cpp @@ -0,0 +1,52 @@ +#include "Node.h" +#include + +class BinarySearchTree { + + Node* insertRecursive(Node* current, int value) { + if (current == nullptr) { + return new Node(value); + } + + if (value < current->value) { + current->left = insertRecursive(current->left, value); + } + else if (value > current->value) { + current->right = insertRecursive(current->right, value); + } + + return current; + }; + + bool searchRecursive(Node* current, int value) { + if (current == nullptr) { + return false; + } + + if (value == current->value) { + return true; + } + else if (value < current->value) { + return searchRecursive(current->left, value); + } + else { + return searchRecursive(current->right, value); + } + }; + +public: + Node* root; + + BinarySearchTree() { + root = nullptr; + }; + + void insert(int value) { + root = insertRecursive(root, value); + }; + + bool search(int value) { + return searchRecursive(root, value); + }; + +}; diff --git a/TreeProject/TreeProject/Branch.cpp b/TreeProject/TreeProject/Branch.cpp new file mode 100644 index 0000000..bdc0ee3 --- /dev/null +++ b/TreeProject/TreeProject/Branch.cpp @@ -0,0 +1,61 @@ +#include "Node.h" + +#include +#include + +class Branch { + Branch* prev_lvl; + std::string str; + + void printTree(Node* root, Branch* prev_lvl, bool isLeft) { + if (root == nullptr) { + return; + } + std::string prev_str = " "; + Branch* branch = new Branch(prev_lvl, prev_str); + printTree(root->right, branch, true); + + if (!prev_lvl) { + branch->str = "---"; + } + else if (isLeft) { + branch->str = ".---"; + prev_str = " |"; + } + else { + branch->str = "'---"; + prev_lvl->str = prev_str; + } + + showBranch(branch); + std::cout << " " << root->value << std::endl; + + if (prev_lvl) { + prev_lvl->str = prev_str; + } + branch->str = " |"; + + printTree(root->left, branch, false); + }; + +public: + Branch() {}; + + Branch(Branch* prev_lvl, std::string str) { + this->prev_lvl = prev_lvl; + this->str = str; + }; + + void showBranch(Branch* lvl) { + if (lvl == nullptr) { + return; + } + showBranch(lvl->prev_lvl); + std::cout << lvl->str; + }; + + void print(Node* root) { + printTree(root, nullptr, false); + }; + +}; \ No newline at end of file diff --git a/TreeProject/TreeProject/Node.h b/TreeProject/TreeProject/Node.h new file mode 100644 index 0000000..73cab08 --- /dev/null +++ b/TreeProject/TreeProject/Node.h @@ -0,0 +1,14 @@ +#pragma once + +class Node { +public: + int value; + Node* left; + Node* right; + + Node(int value) { + this->value = value; + this->left = this->right = nullptr; + }; + +}; diff --git a/TreeProject/TreeProject/TreeProject.vcxproj b/TreeProject/TreeProject/TreeProject.vcxproj new file mode 100644 index 0000000..15dced4 --- /dev/null +++ b/TreeProject/TreeProject/TreeProject.vcxproj @@ -0,0 +1,141 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {d656b510-e9f0-4a22-b040-47f4174d8b29} + TreeProject + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TreeProject/TreeProject/TreeProject.vcxproj.filters b/TreeProject/TreeProject/TreeProject.vcxproj.filters new file mode 100644 index 0000000..3ba1acc --- /dev/null +++ b/TreeProject/TreeProject/TreeProject.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {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/TreeProject/TreeProject/TreeProject.vcxproj.user b/TreeProject/TreeProject/TreeProject.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/TreeProject/TreeProject/TreeProject.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/TreeProject/TreeProject/main.cpp b/TreeProject/TreeProject/main.cpp new file mode 100644 index 0000000..80fa697 --- /dev/null +++ b/TreeProject/TreeProject/main.cpp @@ -0,0 +1,23 @@ +#include "BinarySearchTree.cpp" +#include "Branch.cpp" + +#include + +int main() { + + BinarySearchTree binarySearchTree; + Branch btc; + + binarySearchTree.insert(8); + binarySearchTree.insert(5); + binarySearchTree.insert(19); + binarySearchTree.insert(4); + binarySearchTree.insert(6); + + btc.print(binarySearchTree.root); + + //std::cout << "Searching for 6: " << (binarySearchTree.search(6) ? "Found" : "Not found") << std::endl; + //std::cout << "Searching for 12: " << (binarySearchTree.search(12) ? "Found" : "Not found") << std::endl; + + return 0; +} diff --git a/VectorPairOperation/.vs/VectorPairOperation/FileContentIndex/d6cae7dd-6d5d-4b6b-9dfd-402b45b0e627.vsidx b/VectorPairOperation/.vs/VectorPairOperation/FileContentIndex/d6cae7dd-6d5d-4b6b-9dfd-402b45b0e627.vsidx new file mode 100644 index 0000000..521bb64 Binary files /dev/null and b/VectorPairOperation/.vs/VectorPairOperation/FileContentIndex/d6cae7dd-6d5d-4b6b-9dfd-402b45b0e627.vsidx differ diff --git a/VectorPairOperation/.vs/VectorPairOperation/FileContentIndex/read.lock b/VectorPairOperation/.vs/VectorPairOperation/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/VectorPairOperation/.vs/VectorPairOperation/v17/.suo b/VectorPairOperation/.vs/VectorPairOperation/v17/.suo new file mode 100644 index 0000000..54b7832 Binary files /dev/null and b/VectorPairOperation/.vs/VectorPairOperation/v17/.suo differ diff --git a/VectorPairOperation/.vs/VectorPairOperation/v17/Browse.VC.db b/VectorPairOperation/.vs/VectorPairOperation/v17/Browse.VC.db new file mode 100644 index 0000000..5697d14 Binary files /dev/null and b/VectorPairOperation/.vs/VectorPairOperation/v17/Browse.VC.db differ diff --git a/VectorPairOperation/.vs/VectorPairOperation/v17/ipch/AutoPCH/a3e8cdc4d76f9225/MAIN.ipch b/VectorPairOperation/.vs/VectorPairOperation/v17/ipch/AutoPCH/a3e8cdc4d76f9225/MAIN.ipch new file mode 100644 index 0000000..335fd95 Binary files /dev/null and b/VectorPairOperation/.vs/VectorPairOperation/v17/ipch/AutoPCH/a3e8cdc4d76f9225/MAIN.ipch differ diff --git a/VectorPairOperation/HomeWork1H/HomeWork1H.vcxproj b/VectorPairOperation/HomeWork1H/HomeWork1H.vcxproj new file mode 100644 index 0000000..a679277 --- /dev/null +++ b/VectorPairOperation/HomeWork1H/HomeWork1H.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {7cb99898-36b6-4472-9fd0-1f1e6cd406f8} + HomeWork1H + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/VectorPairOperation/HomeWork1H/HomeWork1H.vcxproj.filters b/VectorPairOperation/HomeWork1H/HomeWork1H.vcxproj.filters new file mode 100644 index 0000000..e8deb3d --- /dev/null +++ b/VectorPairOperation/HomeWork1H/HomeWork1H.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/VectorPairOperation/HomeWork1H/HomeWork1H.vcxproj.user b/VectorPairOperation/HomeWork1H/HomeWork1H.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/VectorPairOperation/HomeWork1H/HomeWork1H.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/VectorPairOperation/HomeWork1H/main.cpp b/VectorPairOperation/HomeWork1H/main.cpp new file mode 100644 index 0000000..ac0fd1b --- /dev/null +++ b/VectorPairOperation/HomeWork1H/main.cpp @@ -0,0 +1,40 @@ +#include +#include +#include + +using namespace std; + +std::vector> vec = { + {111.21, "private"}, + {224.88, "public"}, + {19.7, "protected"}, + {3999.1, "private"}, + {13.5, "public"} +}; + +void rangedOutput() { + for (auto ind : vec) { + std::cout << ind.first << ", " << ind.second << '\n'; + } +} + +void lambdaFunction() { + auto func = [](auto& ind) { + if (ind.second == "public") { + ind.first = 0; + } + else + if (ind.second == "protected") { + ind.second = "private"; + } + std::cout << ind.first << ", " << ind.second << '\n'; + }; + std::cout << std::endl; + for (auto& updated_vec : vec) { func(updated_vec); } +} + +int main(int argc, const char* argv[]) { + + rangedOutput(); + lambdaFunction(); +} diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.exe.recipe b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.exe.recipe new file mode 100644 index 0000000..0c97ed7 --- /dev/null +++ b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.exe.recipe @@ -0,0 +1,11 @@ + + + + + D:\Github\CPPlang2K\VectorPairOperation\x64\Debug\HomeWork1H.exe + + + + + + \ No newline at end of file diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.ilk b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.ilk new file mode 100644 index 0000000..ee0a638 Binary files /dev/null and b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.ilk differ diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.log b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.log new file mode 100644 index 0000000..a08b215 --- /dev/null +++ b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.log @@ -0,0 +1,23 @@ + main.cpp +C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\utility(190,16): warning C4244: инициализация: преобразование "_Ty" в "_Ty1", возможна потеря данных + with + [ + _Ty=double + ] + and + [ + _Ty1=float + ] +D:\Github\CPPlang2K\VectorPairOperation\HomeWork1H\main.cpp(13): message : выполняется компиляция ссылки на экземпляр шаблон функции "std::pair::pair(_Other1 &&,_Other2) noexcept(false)" + with + [ + _Other1=double, + _Other2=const char (&)[8] + ] +D:\Github\CPPlang2K\VectorPairOperation\HomeWork1H\main.cpp(7): message : выполняется компиляция ссылки на экземпляр шаблон функции "std::pair::pair(_Other1 &&,_Other2) noexcept(false)" + with + [ + _Other1=double, + _Other2=const char (&)[8] + ] + HomeWork1H.vcxproj -> D:\Github\CPPlang2K\VectorPairOperation\x64\Debug\HomeWork1H.exe diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.command.1.tlog b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.command.1.tlog new file mode 100644 index 0000000..2fd08b8 Binary files /dev/null and b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.command.1.tlog differ diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.read.1.tlog b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.read.1.tlog new file mode 100644 index 0000000..0ee6869 Binary files /dev/null and b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.read.1.tlog differ diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.write.1.tlog b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.write.1.tlog new file mode 100644 index 0000000..26001a3 Binary files /dev/null and b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/CL.write.1.tlog differ diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/HomeWork1H.lastbuildstate b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/HomeWork1H.lastbuildstate new file mode 100644 index 0000000..1804c12 --- /dev/null +++ b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/HomeWork1H.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0: +Debug|x64|D:\Github\CPPlang2K\VectorPairOperation\| diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.command.1.tlog b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.command.1.tlog new file mode 100644 index 0000000..17464b5 Binary files /dev/null and b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.command.1.tlog differ diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.read.1.tlog b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.read.1.tlog new file mode 100644 index 0000000..138693e Binary files /dev/null and b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.read.1.tlog differ diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.write.1.tlog b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.write.1.tlog new file mode 100644 index 0000000..91b5c91 Binary files /dev/null and b/VectorPairOperation/HomeWork1H/x64/Debug/HomeWork1H.tlog/link.write.1.tlog differ diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/main.obj b/VectorPairOperation/HomeWork1H/x64/Debug/main.obj new file mode 100644 index 0000000..41c5bb9 Binary files /dev/null and b/VectorPairOperation/HomeWork1H/x64/Debug/main.obj differ diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/vc143.idb b/VectorPairOperation/HomeWork1H/x64/Debug/vc143.idb new file mode 100644 index 0000000..1b5e286 Binary files /dev/null and b/VectorPairOperation/HomeWork1H/x64/Debug/vc143.idb differ diff --git a/VectorPairOperation/HomeWork1H/x64/Debug/vc143.pdb b/VectorPairOperation/HomeWork1H/x64/Debug/vc143.pdb new file mode 100644 index 0000000..3ad4665 Binary files /dev/null and b/VectorPairOperation/HomeWork1H/x64/Debug/vc143.pdb differ diff --git a/VectorPairOperation/VectorPairOperation.sln b/VectorPairOperation/VectorPairOperation.sln new file mode 100644 index 0000000..90a2c98 --- /dev/null +++ b/VectorPairOperation/VectorPairOperation.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32901.215 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HomeWork1H", "HomeWork1H\HomeWork1H.vcxproj", "{7CB99898-36B6-4472-9FD0-1F1E6CD406F8}" +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 + {7CB99898-36B6-4472-9FD0-1F1E6CD406F8}.Debug|x64.ActiveCfg = Debug|x64 + {7CB99898-36B6-4472-9FD0-1F1E6CD406F8}.Debug|x64.Build.0 = Debug|x64 + {7CB99898-36B6-4472-9FD0-1F1E6CD406F8}.Debug|x86.ActiveCfg = Debug|Win32 + {7CB99898-36B6-4472-9FD0-1F1E6CD406F8}.Debug|x86.Build.0 = Debug|Win32 + {7CB99898-36B6-4472-9FD0-1F1E6CD406F8}.Release|x64.ActiveCfg = Release|x64 + {7CB99898-36B6-4472-9FD0-1F1E6CD406F8}.Release|x64.Build.0 = Release|x64 + {7CB99898-36B6-4472-9FD0-1F1E6CD406F8}.Release|x86.ActiveCfg = Release|Win32 + {7CB99898-36B6-4472-9FD0-1F1E6CD406F8}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6529EEED-AC62-4D5E-80AE-C6B134E1B959} + EndGlobalSection +EndGlobal diff --git a/VectorPairOperation/x64/Debug/HomeWork1H.exe b/VectorPairOperation/x64/Debug/HomeWork1H.exe new file mode 100644 index 0000000..561fb78 Binary files /dev/null and b/VectorPairOperation/x64/Debug/HomeWork1H.exe differ diff --git a/VectorPairOperation/x64/Debug/HomeWork1H.pdb b/VectorPairOperation/x64/Debug/HomeWork1H.pdb new file mode 100644 index 0000000..4775952 Binary files /dev/null and b/VectorPairOperation/x64/Debug/HomeWork1H.pdb differ