├── .gitignore ├── lab1 ├── cript │ ├── cript.sln │ ├── crypt │ │ ├── ReadMe.txt │ │ ├── cript.cpp │ │ ├── cript_utils.cpp │ │ ├── cript_utils.h │ │ ├── crypt.vcxproj │ │ ├── crypt.vcxproj.filters │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h │ └── test │ │ ├── ReadMe.txt │ │ ├── decrypted_output.txt │ │ ├── output.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── test.cpp │ │ ├── test.vcxproj │ │ ├── test.vcxproj.filters │ │ └── text.txt ├── find_text │ ├── find_text.sln │ ├── find_text │ │ ├── find_text.cpp │ │ ├── find_text.vcxproj │ │ ├── find_text.vcxproj.filters │ │ ├── find_text_utils.cpp │ │ ├── find_text_utils.h │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h │ └── tests │ │ ├── empty_test.txt │ │ ├── multyline_test.txt │ │ ├── oneline_test.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── tests.cpp │ │ ├── tests.vcxproj │ │ └── tests.vcxproj.filters ├── flip_byte │ ├── flip_byte.sln │ ├── flip_byte │ │ ├── ReadMe.txt │ │ ├── flip_byte.cpp │ │ ├── flip_byte.vcxproj │ │ ├── flip_byte.vcxproj.filters │ │ ├── flip_byte_utils.cpp │ │ ├── flip_byte_utils.h │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h │ └── tests │ │ ├── ReadMe.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── tests.cpp │ │ ├── tests.vcxproj │ │ └── tests.vcxproj.filters ├── labyrinth │ ├── labyrinth.sln │ ├── labyrinth │ │ ├── ReadMe.txt │ │ ├── labyrinth.cpp │ │ ├── labyrinth.vcxproj │ │ ├── labyrinth.vcxproj.filters │ │ ├── labyrinth_utils.cpp │ │ ├── labyrinth_utils.h │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h │ └── test │ │ ├── ReadMe.txt │ │ ├── map.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── test.cpp │ │ ├── test.vcxproj │ │ └── test.vcxproj.filters └── multmatrix │ ├── multmatrix.sln │ ├── multmatrix │ ├── ReadMe.txt │ ├── multmatrix.cpp │ ├── multmatrix.vcxproj │ ├── multmatrix.vcxproj.filters │ ├── multmatrix_utils.cpp │ ├── multmatrix_utils.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h │ └── tests │ ├── ReadMe.txt │ ├── correct_matrix.txt │ ├── incorrect_matrix.txt │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── tests.cpp │ ├── tests.vcxproj │ └── tests.vcxproj.filters ├── lab2 ├── FindAndReplace │ ├── FindAndReplace.sln │ ├── FindAndReplace │ │ ├── FindAndReplace.cpp │ │ ├── FindAndReplace.vcxproj │ │ ├── FindAndReplace.vcxproj.filters │ │ ├── replace_utils.cpp │ │ ├── replace_utils.h │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h │ └── tests │ │ ├── ReadMe.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── tests.cpp │ │ ├── tests.vcxproj │ │ └── tests.vcxproj.filters ├── ParseUrl │ ├── ParseUrl.sln │ ├── ParseUrl │ │ ├── ParseUrl.cpp │ │ ├── ParseUrl.vcxproj │ │ ├── ParseUrl.vcxproj.filters │ │ ├── ReadMe.txt │ │ ├── parse_url_utils.cpp │ │ ├── parse_url_utils.h │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h │ └── tests │ │ ├── ReadMe.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── tests.cpp │ │ ├── tests.vcxproj │ │ └── tests.vcxproj.filters ├── PrimeNumbers │ ├── PrimeNumbers.sln │ ├── PrimeNumbers │ │ ├── PrimeNumbers.cpp │ │ ├── PrimeNumbers.vcxproj │ │ ├── PrimeNumbers.vcxproj.filters │ │ ├── ReadMe.txt │ │ ├── prime_nubers_utils.h │ │ ├── prime_numbers_utils.cpp │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h │ └── tests │ │ ├── ReadMe.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── tests.cpp │ │ ├── tests.vcxproj │ │ └── tests.vcxproj.filters ├── task1 │ ├── task1.sln │ ├── task1 │ │ ├── ReadMe.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── task1.cpp │ │ ├── task1.vcxproj │ │ ├── task1.vcxproj.filters │ │ ├── vector_utils.cpp │ │ └── vector_utils.h │ └── test │ │ ├── ReadMe.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── test.cpp │ │ ├── test.vcxproj │ │ └── test.vcxproj.filters └── translator │ ├── tests │ ├── ReadMe.txt │ ├── dictinary1.txt │ ├── dictionary.txt │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── tests.cpp │ ├── tests.vcxproj │ └── tests.vcxproj.filters │ ├── translator.sln │ └── translator │ ├── ReadMe.txt │ ├── Translator.h │ ├── TranslatorImpl.cpp │ ├── dictionary.txt │ ├── input_output_utils.cpp │ ├── input_output_utils.h │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── translator.cpp │ ├── translator.vcxproj │ └── translator.vcxproj.filters ├── lab3 ├── Calculator │ ├── Calculator.sln │ ├── Calculator │ │ ├── CValueHolder.cpp │ │ ├── CValueHolder.h │ │ ├── Calculator.cpp │ │ ├── Calculator.h │ │ ├── Calculator.vcxproj │ │ ├── Calculator.vcxproj.filters │ │ ├── Function.cpp │ │ ├── Function.h │ │ ├── Menu.h │ │ ├── ReadMe.txt │ │ ├── Variable.cpp │ │ ├── Variable.h │ │ ├── calculate_prog.cpp │ │ ├── calculator_utils.cpp │ │ ├── calculator_utils.h │ │ ├── constants.h │ │ ├── print_utils.cpp │ │ ├── print_utils.h │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h │ └── tests │ │ ├── FnOut.txt │ │ ├── FnsOut.txt │ │ ├── NanOut.txt │ │ ├── ReadMe.txt │ │ ├── VarOut.txt │ │ ├── VarsOut.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── tests.cpp │ │ ├── tests.vcxproj │ │ ├── tests.vcxproj.filters │ │ └── tests_logger.cpp └── carmodel │ ├── carmodel.sln │ ├── carmodel │ ├── Car.cpp │ ├── Car.h │ ├── Menu.h │ ├── ReadMe.txt │ ├── Sphere.h │ ├── carmodel.cpp │ ├── carmodel.vcxproj │ ├── carmodel.vcxproj.filters │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h │ └── tests │ ├── ReadMe.txt │ ├── car_tests.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── tests.cpp │ ├── tests.vcxproj │ └── tests.vcxproj.filters ├── lab4 └── Task1 │ ├── Task1.sln │ ├── Task1 │ ├── Body.cpp │ ├── Body.h │ ├── Compound.cpp │ ├── Compound.h │ ├── Cone.cpp │ ├── Cone.h │ ├── Cylinder.cpp │ ├── Cylinder.h │ ├── Menu.h │ ├── Parallelepiped.cpp │ ├── Parallelepiped.h │ ├── ReadMe.txt │ ├── SolidBody.h │ ├── Sphere.cpp │ ├── Sphere.h │ ├── Task1.cpp │ ├── Task1.vcxproj │ ├── Task1.vcxproj.filters │ ├── body_utils.cpp │ ├── body_utils.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h │ └── tests │ ├── ReadMe.txt │ ├── compound_content_compound_body.txt │ ├── compound_content_simple_body.txt │ ├── compund_to_string.txt │ ├── empty_compound_init.txt │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── tests.cpp │ ├── tests.h │ ├── tests.vcxproj │ ├── tests.vcxproj.filters │ └── tests_logger.cpp ├── lab5 ├── MyString │ ├── MyString.sln │ ├── MyString │ │ ├── MyString.cpp │ │ ├── MyString.h │ │ ├── MyString.vcxproj │ │ ├── MyString.vcxproj.filters │ │ ├── ReadMe.txt │ │ ├── index.cpp │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h │ └── tests │ │ ├── ReadMe.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── tests.cpp │ │ ├── tests.vcxproj │ │ ├── tests.vcxproj.filters │ │ └── tests_logger.cpp └── Rational │ ├── Rational.sln │ ├── Rational │ ├── Rational.cpp │ ├── Rational.h │ ├── Rational.vcxproj │ ├── Rational.vcxproj.filters │ ├── ReadMe.txt │ ├── index.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h │ └── tests │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── tests.cpp │ ├── tests.vcxproj │ ├── tests.vcxproj.filters │ └── tests_logger.cpp ├── lab6 ├── StrigList │ ├── StrigList.sln │ ├── StrigList │ │ ├── StrigList.vcxproj │ │ ├── StrigList.vcxproj.filters │ │ ├── StringList.cpp │ │ ├── StringList.h │ │ ├── index.cpp │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h │ └── tests │ │ ├── ReadMe.txt │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── targetver.h │ │ ├── tests.cpp │ │ ├── tests.vcxproj │ │ ├── tests.vcxproj.filters │ │ └── tests_logger.cpp └── http_url │ ├── http_url.sln │ ├── http_url │ ├── HttpUrl.cpp │ ├── HttpUrl.h │ ├── ReadMe.txt │ ├── UrlParsingError.cpp │ ├── UrlParsingError.h │ ├── http_url.cpp │ ├── http_url.vcxproj │ ├── http_url.vcxproj.filters │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h │ └── tests │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── tests.cpp │ ├── tests.vcxproj │ ├── tests.vcxproj.filters │ └── tests_logger.cpp └── lab7 ├── MyList ├── MyList.sln ├── MyList │ ├── MyList.h │ ├── MyList.vcxproj │ ├── MyList.vcxproj.filters │ ├── index.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h └── tests │ ├── ReadMe.txt │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── tests.cpp │ ├── tests.vcxproj │ ├── tests.vcxproj.filters │ └── tests_logger.cpp └── find_max_ex ├── find_max_ex.sln ├── find_max_ex ├── ReadMe.txt ├── find_max_ex.cpp ├── find_max_ex.vcxproj ├── find_max_ex.vcxproj.filters ├── find_max_func.h ├── stdafx.cpp ├── stdafx.h └── targetver.h └── tests ├── ReadMe.txt ├── stdafx.cpp ├── stdafx.h ├── targetver.h ├── tests.cpp ├── tests.vcxproj ├── tests.vcxproj.filters └── tests_logger.cpp /lab1/cript/crypt/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : crypt Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this crypt application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your crypt application. 9 | 10 | 11 | crypt.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | crypt.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | crypt.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named crypt.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab1/cript/crypt/cript.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "cript_utils.h" 3 | 4 | using namespace std; 5 | 6 | int main(int argc, char * argv[]) 7 | { 8 | ifstream input; 9 | ofstream output; 10 | if (CheckArgumentCount(argc) && 11 | CheckSettings(argv[1]) && CheckKey(argv[4]) && 12 | OpenFile(input, argv[2]) && OpenFile(output, argv[3])) 13 | { 14 | return 1; 15 | } 16 | char key = stoi(argv[4], nullptr, 10); 17 | if (argv[1] == DECRIPT_PREFIX) 18 | { 19 | Encode(input, output, key, Decript); 20 | } 21 | else 22 | { 23 | Encode(input, output, key, Cript); 24 | } 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /lab1/cript/crypt/cript_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | const std::string CRIPT_PREFIX = "crypt"; 5 | const std::string DECRIPT_PREFIX = "decrypt"; 6 | 7 | bool CheckArgumentCount(int argumentCount); 8 | bool CheckSettings(const std::string & settings); 9 | bool CheckKey(const std::string & key); 10 | bool OpenFile(std::ofstream & file, std::string fileName); 11 | bool OpenFile(std::ifstream & file, std::string fileName); 12 | void Encode(std::ifstream & input, std::ofstream & output, uint8_t key, const std::function & EncodingFunction); 13 | uint8_t Cript(uint8_t byte, uint8_t key); 14 | uint8_t Decript(uint8_t byte, uint8_t key); 15 | -------------------------------------------------------------------------------- /lab1/cript/crypt/crypt.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab1/cript/crypt/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" -------------------------------------------------------------------------------- /lab1/cript/crypt/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include -------------------------------------------------------------------------------- /lab1/cript/crypt/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /lab1/cript/test/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : test Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this test application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your test application. 9 | 10 | 11 | test.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | test.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | test.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named test.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab1/cript/test/decrypted_output.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab1/cript/test/decrypted_output.txt -------------------------------------------------------------------------------- /lab1/cript/test/output.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab1/cript/test/output.txt -------------------------------------------------------------------------------- /lab1/cript/test/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | //================================================= 4 | #include 5 | //================================================= 6 | -------------------------------------------------------------------------------- /lab1/cript/test/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | ///======================================= 13 | #define BOOST_TEST_MODULE UrlUtilsTests 14 | #define BOOST_TEST_INCLUDED 15 | #pragma warning (disable:4702) 16 | #include 17 | ///======================================= 18 | -------------------------------------------------------------------------------- /lab1/cript/test/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | -------------------------------------------------------------------------------- /lab1/cript/test/test.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab1/cript/test/test.cpp -------------------------------------------------------------------------------- /lab1/cript/test/test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab1/cript/test/text.txt: -------------------------------------------------------------------------------- 1 | 123 2 | -------------------------------------------------------------------------------- /lab1/find_text/find_text/find_text.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "find_text_utils.h" 3 | 4 | 5 | using namespace std; 6 | 7 | int main(int argc, char * argv[]) 8 | { 9 | ifstream inputFile; 10 | if (!ProcesFileErrors(argc, inputFile, argv)) 11 | { 12 | return 0; 13 | } 14 | if (FindStringInFile(inputFile, string(argv[2]), [](int lineIndex, const string &) { 15 | cout << lineIndex << endl; 16 | })) 17 | { 18 | cout << "String not found" << endl; 19 | return 1; 20 | } 21 | return 0; 22 | } -------------------------------------------------------------------------------- /lab1/find_text/find_text/find_text.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /lab1/find_text/find_text/find_text_utils.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "find_text_utils.h" 3 | 4 | //using namespace std; 5 | 6 | 7 | bool ProcesFileErrors(int namesCount, std::ifstream & input, char * fileNames[]) 8 | { 9 | if (namesCount != 3) 10 | { 11 | std::cout << "Invalid argument count" << std::endl; 12 | return false; 13 | } 14 | input.open(fileNames[1]); 15 | if (!input.is_open()) 16 | { 17 | std::cout << "Can not open input file" << std::endl; 18 | return false; 19 | } 20 | return true; 21 | } 22 | 23 | bool FindStringInFile(std::ifstream & input, const std::string & comparedString, const findStringCallback & callback) 24 | { 25 | std::string tempString; 26 | bool isFound = false; 27 | for (int currentLine = 1; std::getline(input, tempString); ++currentLine) 28 | { 29 | if (tempString.find(comparedString, 0) != std::string::npos) 30 | { 31 | isFound = true; 32 | callback(currentLine, tempString); 33 | } 34 | } 35 | return isFound; 36 | } 37 | 38 | bool FindStringInFile(std::ifstream & input, const std::string & comparedString) 39 | { 40 | std::string tempString; 41 | bool isFound = false; 42 | for (int currentLine = 1; std::getline(input, tempString); ++currentLine) 43 | { 44 | if (tempString.find(comparedString, 0) != std::string::npos) 45 | { 46 | isFound = true; 47 | } 48 | } 49 | return isFound; 50 | } -------------------------------------------------------------------------------- /lab1/find_text/find_text/find_text_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | using findStringCallback = std::function; 5 | 6 | bool ProcesFileErrors(int namesCount, std::ifstream & input, char * fileNames[]); 7 | bool FindStringInFile(std::ifstream & input, const std::string & comparedString, const findStringCallback & callback); 8 | bool FindStringInFile(std::ifstream & input, const std::string & comparedString); -------------------------------------------------------------------------------- /lab1/find_text/find_text/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" -------------------------------------------------------------------------------- /lab1/find_text/find_text/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include -------------------------------------------------------------------------------- /lab1/find_text/find_text/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab1/find_text/tests/empty_test.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab1/find_text/tests/empty_test.txt -------------------------------------------------------------------------------- /lab1/find_text/tests/multyline_test.txt: -------------------------------------------------------------------------------- 1 | 1234 2 | 1234 3 | -------------------------------------------------------------------------------- /lab1/find_text/tests/oneline_test.txt: -------------------------------------------------------------------------------- 1 | 1234 -------------------------------------------------------------------------------- /lab1/find_text/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | //================================================= 4 | #include 5 | //================================================= -------------------------------------------------------------------------------- /lab1/find_text/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | ///======================================= 14 | #define BOOST_TEST_MODULE Task1TestModule 15 | #define BOOST_TEST_INCLUDED 16 | #pragma warning (disable:4702) 17 | #include 18 | ///======================================= -------------------------------------------------------------------------------- /lab1/find_text/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab1/find_text/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /lab1/flip_byte/flip_byte/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : flip_byte Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this flip_byte application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your flip_byte application. 9 | 10 | 11 | flip_byte.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | flip_byte.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | flip_byte.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named flip_byte.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab1/flip_byte/flip_byte/flip_byte.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab1/flip_byte/flip_byte/flip_byte.cpp -------------------------------------------------------------------------------- /lab1/flip_byte/flip_byte/flip_byte.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab1/flip_byte/flip_byte/flip_byte_utils.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "flip_byte_utils.h" 3 | 4 | using namespace std; 5 | 6 | bool CheckIsByteNumber(const string str) 7 | { 8 | size_t stringLen = str.length(); 9 | int number = 0; 10 | for (size_t i = 0; i < stringLen; ++i) 11 | { 12 | number = (number * 10 + (str[i] - '0')); 13 | if (('0' > str[i]) || (str[i] > '9') || (number > 255) || (number < 0)) 14 | { 15 | return false; 16 | } 17 | } 18 | return true; 19 | } 20 | 21 | bool CheckInput(int inputCount, char * inputValue[]) 22 | { 23 | if (inputCount != 2) 24 | { 25 | cout << "Invalid argument count" << endl; 26 | return false; 27 | } 28 | if (!CheckIsByteNumber(inputValue[1])) 29 | { 30 | cout << "This is not a byte number" << endl; 31 | return false; 32 | } 33 | return true; 34 | } 35 | 36 | uint8_t FlipByte(uint8_t number) 37 | { 38 | uint8_t temp = (number << 4) & 0b11110000; 39 | number = (number >> 4) & 0b00001111; 40 | number |= temp; 41 | temp = (number >> 2) & 0b00110011; 42 | number = (number << 2) & 0b11001100; 43 | number |= temp; 44 | temp = (number >> 1) & 0b01010101; 45 | number = (number << 1) & 0b10101010; 46 | number |= temp; 47 | return number; 48 | } -------------------------------------------------------------------------------- /lab1/flip_byte/flip_byte/flip_byte_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | bool CheckInput(int inputCount, char * inputValue[]); 5 | uint8_t FlipByte(uint8_t number); -------------------------------------------------------------------------------- /lab1/flip_byte/flip_byte/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" -------------------------------------------------------------------------------- /lab1/flip_byte/flip_byte/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include -------------------------------------------------------------------------------- /lab1/flip_byte/flip_byte/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab1/flip_byte/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab1/flip_byte/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | //================================================= 4 | #include 5 | //================================================= -------------------------------------------------------------------------------- /lab1/flip_byte/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | ///======================================= 9 | #define BOOST_TEST_MODULE UrlUtilsTests 10 | #define BOOST_TEST_INCLUDED 11 | #pragma warning (disable:4702) 12 | #include <./boost/test/unit_test.hpp> 13 | ///======================================= -------------------------------------------------------------------------------- /lab1/flip_byte/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab1/flip_byte/tests/tests.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "../flip_byte/flip_byte_utils.h" 3 | 4 | BOOST_AUTO_TEST_SUITE(InputDataTest) 5 | 6 | 7 | BOOST_AUTO_TEST_CASE(IncorrectArgumentCount) 8 | { 9 | char * strArr[] = { "", "123" }; 10 | BOOST_CHECK(!CheckInput(1, strArr)); 11 | BOOST_CHECK(!CheckInput(3, strArr)); 12 | } 13 | 14 | BOOST_AUTO_TEST_CASE(IncorrectArgument) 15 | { 16 | char * strArr[] = { "", "1234a" }; 17 | BOOST_CHECK(!CheckInput(2, strArr)); 18 | strArr[1] = "a3"; 19 | BOOST_CHECK(!CheckInput(2, strArr)); 20 | strArr[1] = "1234"; 21 | BOOST_CHECK(!CheckInput(2, strArr)); 22 | } 23 | 24 | BOOST_AUTO_TEST_CASE(CorrectData) 25 | { 26 | char * strArr[] = {"", "123"}; 27 | BOOST_CHECK(CheckInput(2, strArr)); 28 | } 29 | 30 | BOOST_AUTO_TEST_SUITE_END() 31 | 32 | BOOST_AUTO_TEST_SUITE(FlipByteTest) 33 | 34 | BOOST_AUTO_TEST_CASE(NotFlipedNumber) 35 | { 36 | BOOST_CHECK(FlipByte(126) == 126); 37 | } 38 | 39 | BOOST_AUTO_TEST_CASE(CorrectData) 40 | { 41 | BOOST_CHECK(FlipByte(1) == 128); 42 | BOOST_CHECK(FlipByte(23) == 232); 43 | } 44 | 45 | BOOST_AUTO_TEST_SUITE_END() -------------------------------------------------------------------------------- /lab1/flip_byte/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab1/labyrinth/labyrinth/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : labyrinth Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this labyrinth application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your labyrinth application. 9 | 10 | 11 | labyrinth.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | labyrinth.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | labyrinth.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named labyrinth.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab1/labyrinth/labyrinth/labyrinth.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "labyrinth_utils.h" 3 | 4 | using namespace std; 5 | 6 | int main(int argc, char * argv[]) 7 | { 8 | ifstream input; 9 | ofstream output; 10 | point startPoint, endPoint; 11 | labyrinth map; 12 | if (!CheckArgumentCount(argc) || !OpenFile(input, argv[1]) || !OpenFile(input, argv[2])) 13 | { 14 | return 1; 15 | } 16 | if (!ReadLabyrint(input, map, startPoint, endPoint)) 17 | { 18 | cout << "You do not init start or end point" << endl; 19 | cout << "Init start point like '" << START_CHAR << "'"; 20 | cout << " and "; 21 | cout << "end point like '" << END_CHAR << "'" << endl; 22 | return 1; 23 | } 24 | if (!FillLabyrinth(map, startPoint, endPoint)) 25 | { 26 | cout << "Way is not found. Check labyrinth." << endl; 27 | return 1; 28 | } 29 | FillLabyrinthWay(map, endPoint); 30 | PrintWay(output, map, startPoint, endPoint); 31 | return 0; 32 | } -------------------------------------------------------------------------------- /lab1/labyrinth/labyrinth/labyrinth.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab1/labyrinth/labyrinth/labyrinth_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | using labyrinth = std::vector>; 5 | struct point 6 | { 7 | size_t x; 8 | size_t y; 9 | int level; 10 | }; 11 | 12 | const char WALL_CHAR = '#'; 13 | const char START_CHAR = 'A'; 14 | const char WAY_CHAR = '*'; 15 | const char END_CHAR = 'B'; 16 | 17 | bool CheckArgumentCount(int argumentCount); 18 | bool OpenFile(std::ifstream & file, std::string fileName); 19 | bool OpenFile(std::ofstream & file, std::string fileName); 20 | bool ReadLabyrint(std::ifstream & input, labyrinth & map, point & startPoint, point & endPoint); 21 | bool FillLabyrinth(labyrinth & map, const point & startPoint, const point & endPoint); 22 | void PushPoints(labyrinth & map, point & currentPoint, std::queue & points); 23 | void PushPoint(labyrinth & map, const point & currentPoint, std::queue & points); 24 | void FillLabyrinthWay(labyrinth & map, const point & endPoint); 25 | point GetVicinityMinPoint(const labyrinth & map, point currentPoint); 26 | void PrintWay(std::ofstream & output, const labyrinth & map, point & startPoint, point & endPoint); -------------------------------------------------------------------------------- /lab1/labyrinth/labyrinth/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | -------------------------------------------------------------------------------- /lab1/labyrinth/labyrinth/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include -------------------------------------------------------------------------------- /lab1/labyrinth/labyrinth/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab1/labyrinth/test/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : test Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this test application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your test application. 9 | 10 | 11 | test.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | test.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | test.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named test.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab1/labyrinth/test/map.txt: -------------------------------------------------------------------------------- 1 | ###### 2 | #A#B # 3 | # # # 4 | # # 5 | ###### -------------------------------------------------------------------------------- /lab1/labyrinth/test/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | //================================================= 4 | #include 5 | //================================================= -------------------------------------------------------------------------------- /lab1/labyrinth/test/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | 14 | ///======================================= 15 | #define BOOST_TEST_MODULE UrlUtilsTests 16 | #define BOOST_TEST_INCLUDED 17 | #pragma warning (disable:4702) 18 | #include <./boost/test/unit_test.hpp> 19 | ///======================================= 20 | -------------------------------------------------------------------------------- /lab1/labyrinth/test/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab1/labyrinth/test/test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab1/multmatrix/multmatrix/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : multmatrix Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this multmatrix application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your multmatrix application. 9 | 10 | 11 | multmatrix.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | multmatrix.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | multmatrix.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named multmatrix.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab1/multmatrix/multmatrix/multmatrix.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "multmatrix_utils.h" 3 | 4 | using namespace std; 5 | 6 | int main(int argc, char * argv[]) 7 | { 8 | matrix matrix1; 9 | matrix matrix2; 10 | ifstream matrixFile1; 11 | ifstream matrixFile2; 12 | if (!CheckArgumentCount(argc) || 13 | !OpenFile(matrixFile1, argv[1]) || !GetMatrix(matrixFile1, matrix1) || 14 | !OpenFile(matrixFile2, argv[2]) || !GetMatrix(matrixFile2, matrix2)) 15 | { 16 | return 1; 17 | } 18 | matrix result = MultyplyMatrix(matrix1, matrix2); 19 | PrintMatrix(result); 20 | return 0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /lab1/multmatrix/multmatrix/multmatrix.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab1/multmatrix/multmatrix/multmatrix_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | const int MATRIX_SIZE = 3; 4 | typedef std::array, MATRIX_SIZE> matrix; 5 | 6 | bool CheckArgumentCount(int argumentCount); 7 | bool OpenFile(std::ifstream & fileStream, char * fileName); 8 | bool GetMatrix(std::ifstream & inputFile, matrix & gettingMatrix); 9 | void PrintMatrix(const matrix & outMatrix); 10 | matrix MultyplyMatrix(const matrix & matrix1, const matrix & matrix2); -------------------------------------------------------------------------------- /lab1/multmatrix/multmatrix/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" -------------------------------------------------------------------------------- /lab1/multmatrix/multmatrix/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include -------------------------------------------------------------------------------- /lab1/multmatrix/multmatrix/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab1/multmatrix/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab1/multmatrix/tests/correct_matrix.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | 4 5 6 3 | 7 8 9 4 | -------------------------------------------------------------------------------- /lab1/multmatrix/tests/incorrect_matrix.txt: -------------------------------------------------------------------------------- 1 | 1 a 2 3 2 | 4 5 6 3 | 7 8 9 4 | -------------------------------------------------------------------------------- /lab1/multmatrix/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | //================================================= 4 | #include 5 | //================================================= -------------------------------------------------------------------------------- /lab1/multmatrix/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | ///======================================= 13 | #define BOOST_TEST_MODULE UrlUtilsTests 14 | #define BOOST_TEST_INCLUDED 15 | #pragma warning (disable:4702) 16 | #include <./boost/test/unit_test.hpp> 17 | ///======================================= -------------------------------------------------------------------------------- /lab1/multmatrix/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab1/multmatrix/tests/tests.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "../multmatrix/multmatrix_utils.h" 3 | 4 | bool CompareMatrix(matrix const & matrix1, matrix const & matrix2) 5 | { 6 | for (int i = 0; i < MATRIX_SIZE; ++i) 7 | { 8 | for (int j = 0; j < MATRIX_SIZE; ++j) 9 | { 10 | if (matrix1[i][j] != matrix2[i][j]) 11 | { 12 | return false; 13 | } 14 | } 15 | } 16 | return true; 17 | } 18 | 19 | BOOST_AUTO_TEST_SUITE(GetMatrixTest) 20 | 21 | BOOST_AUTO_TEST_CASE(CorrectInputFile) 22 | { 23 | std::ifstream input("correct_matrix.txt"); 24 | matrix a; 25 | BOOST_CHECK(GetMatrix(input, a)); 26 | matrix correctMatrix; 27 | correctMatrix[0] = { 1, 2, 3 }; 28 | correctMatrix[1] = { 4, 5, 6 }; 29 | correctMatrix[2] = { 7, 8, 9 }; 30 | BOOST_CHECK(CompareMatrix(correctMatrix, a)); 31 | } 32 | 33 | BOOST_AUTO_TEST_CASE(IncorrectInputFile) 34 | { 35 | std::ifstream input("incorrectMatrix.txt"); 36 | matrix a; 37 | BOOST_CHECK(!GetMatrix(input, a)); 38 | } 39 | 40 | BOOST_AUTO_TEST_SUITE_END() 41 | 42 | BOOST_AUTO_TEST_SUITE(CheckMyltyply) 43 | 44 | BOOST_AUTO_TEST_CASE(Check) 45 | { 46 | matrix a; 47 | a[0] = { 1, 2, 3 }; 48 | a[1] = { 4, 5, 6 }; 49 | a[2] = { 7, 8, 9 }; 50 | matrix b; 51 | b[0] = { 1, 2, 3 }; 52 | b[1] = { 4, 5, 6 }; 53 | b[2] = { 7, 8, 9 }; 54 | matrix result = MultyplyMatrix(a, b); 55 | matrix correctResult; 56 | correctResult[0] = { 30, 36, 42 }; 57 | correctResult[1] = { 66, 81, 96 }; 58 | correctResult[2] = { 102, 126, 150 }; 59 | BOOST_CHECK(CompareMatrix(result, correctResult)); 60 | } 61 | 62 | BOOST_AUTO_TEST_SUITE_END() 63 | -------------------------------------------------------------------------------- /lab1/multmatrix/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab2/FindAndReplace/FindAndReplace/FindAndReplace.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "replace_utils.h" 3 | 4 | int main(int argc, char * argv[]) 5 | { 6 | if (!CheckArgumentCount(argc) || !CheckReplacingString(argv[1])) 7 | { 8 | return 1; 9 | } 10 | std::string line; 11 | while (std::getline(std::cin, line)) 12 | { 13 | std::cout << FindAndReplace(line, argv[1], argv[2]); 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /lab2/FindAndReplace/FindAndReplace/FindAndReplace.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab2/FindAndReplace/FindAndReplace/replace_utils.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "replace_utils.h" 3 | 4 | bool CheckArgumentCount(int argumentCount) 5 | { 6 | if (argumentCount != 3) 7 | { 8 | std::cout << "Invalid argument count" << std::endl; 9 | } 10 | return argumentCount == 3; 11 | } 12 | 13 | bool CheckReplacingString(const std::string & str) 14 | { 15 | if (str == "") 16 | { 17 | std::cout << "Replacing string can not be empty" << std::endl; 18 | } 19 | return str != ""; 20 | } 21 | 22 | std::string FindAndReplace(const std::string & subject, const std::string & search, const std::string & replace) 23 | { 24 | std::string result = ""; 25 | auto pos = subject.find(search, 0); 26 | auto startPos = 0; 27 | while (pos != subject.size()) 28 | { 29 | result += subject.substr(startPos, pos); 30 | pos = subject.find(search, startPos); 31 | startPos = pos; 32 | } 33 | result += subject.substr(startPos, pos); 34 | return result; 35 | } -------------------------------------------------------------------------------- /lab2/FindAndReplace/FindAndReplace/replace_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | bool CheckReplacingString(const std::string & str); 5 | bool CheckArgumentCount(int argumentCount); 6 | std::string FindAndReplace(const std::string & subject, const std::string & search, const std::string & replace); -------------------------------------------------------------------------------- /lab2/FindAndReplace/FindAndReplace/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // FindAndReplace.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /lab2/FindAndReplace/FindAndReplace/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include -------------------------------------------------------------------------------- /lab2/FindAndReplace/FindAndReplace/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | -------------------------------------------------------------------------------- /lab2/FindAndReplace/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab2/FindAndReplace/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | //================================================= 4 | #include 5 | //================================================= -------------------------------------------------------------------------------- /lab2/FindAndReplace/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | ///======================================= 14 | #define BOOST_TEST_MODULE UrlUtilsTests 15 | #define BOOST_TEST_INCLUDED 16 | #pragma warning (disable:4702) 17 | #include 18 | ///======================================= -------------------------------------------------------------------------------- /lab2/FindAndReplace/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab2/FindAndReplace/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab2/ParseUrl/ParseUrl/ParseUrl.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "parse_url_utils.h" 3 | 4 | int main() 5 | { 6 | std::string url; 7 | Protocol protocol; 8 | int port; 9 | std::string host; 10 | std::string document; 11 | while (std::getline(std::cin, url)) 12 | { 13 | if (ParseURL(url, protocol, port, host, document)) 14 | { 15 | std::cout << url << std::endl; 16 | std::cout << "HOST: " << host << std::endl; 17 | std::cout << "PORT: " << port << std::endl; 18 | std::cout << "DOC: " << document << std::endl; 19 | } 20 | else 21 | { 22 | std::cout << "Incorrect url" << std::endl; 23 | } 24 | } 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /lab2/ParseUrl/ParseUrl/ParseUrl.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab2/ParseUrl/ParseUrl/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : ParseUrl Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this ParseUrl application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your ParseUrl application. 9 | 10 | 11 | ParseUrl.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | ParseUrl.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | ParseUrl.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named ParseUrl.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab2/ParseUrl/ParseUrl/parse_url_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | enum class Protocol 5 | { 6 | HTTP = 80, 7 | HTTPS = 443, 8 | FTP = 21, 9 | NO_PROTOCOL, 10 | }; 11 | 12 | Protocol StringToProtocol(const std::string & protocol); 13 | std::string ProtocolToString(Protocol protocol); 14 | std::string ToLowCase(std::string str); 15 | bool IsUrl(const std::string & url); 16 | bool ParseURL(const std::string & url, Protocol & protocol, int & port, std::string & host, std::string & document); -------------------------------------------------------------------------------- /lab2/ParseUrl/ParseUrl/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // ParseUrl.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /lab2/ParseUrl/ParseUrl/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | // TODO: reference additional headers your program requires here 18 | -------------------------------------------------------------------------------- /lab2/ParseUrl/ParseUrl/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab2/ParseUrl/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab2/ParseUrl/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | //================================================= 4 | #include 5 | //================================================= -------------------------------------------------------------------------------- /lab2/ParseUrl/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | ///======================================= 12 | #define BOOST_TEST_MODULE UrlUtilsTests 13 | #define BOOST_TEST_INCLUDED 14 | #pragma warning (disable:4702) 15 | #include 16 | ///======================================= -------------------------------------------------------------------------------- /lab2/ParseUrl/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab2/ParseUrl/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab2/PrimeNumbers/PrimeNumbers/PrimeNumbers.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "prime_nubers_utils.h" 3 | 4 | int main(int argc, char * argv[]) 5 | { 6 | if (!CheckArgumentCount(argc) || !CheckUpperBound(argv[1])) 7 | { 8 | return 1; 9 | } 10 | unsigned long upperBound = std::stoul(argv[1]); 11 | std::set primeNumbers = GeneratePrimeNumbersSet(upperBound); 12 | for (auto element : primeNumbers) 13 | { 14 | std::cout << element << std::endl; 15 | } 16 | std::cout << primeNumbers.size() << std::endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /lab2/PrimeNumbers/PrimeNumbers/PrimeNumbers.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab2/PrimeNumbers/PrimeNumbers/prime_nubers_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | bool CheckArgumentCount(int argumentCount); 5 | bool CheckUpperBound(std::string upperBound); 6 | std::set GeneratePrimeNumbersSet(int upperBound); -------------------------------------------------------------------------------- /lab2/PrimeNumbers/PrimeNumbers/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // PrimeNumbers.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /lab2/PrimeNumbers/PrimeNumbers/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include -------------------------------------------------------------------------------- /lab2/PrimeNumbers/PrimeNumbers/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab2/PrimeNumbers/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab2/PrimeNumbers/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | //================================================= 4 | #include 5 | //================================================= -------------------------------------------------------------------------------- /lab2/PrimeNumbers/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | ///======================================= 14 | #define BOOST_TEST_MODULE UrlUtilsTests 15 | #define BOOST_TEST_INCLUDED 16 | #pragma warning (disable:4702) 17 | #include 18 | ///======================================= -------------------------------------------------------------------------------- /lab2/PrimeNumbers/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab2/PrimeNumbers/tests/tests.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "../PrimeNumbers/prime_nubers_utils.h" 3 | 4 | BOOST_AUTO_TEST_SUITE(Test_GeneratePrimeNumbers) 5 | BOOST_AUTO_TEST_SUITE(Find_all_prime_numbers_test) 6 | std::set correctPrimeNumbersSet({ 2, 3, 5, 7, 11, 13, 17, 19 }); 7 | BOOST_AUTO_TEST_CASE(Not_prime_end_number) 8 | { 9 | std::set primeNumbers = GeneratePrimeNumbersSet(20); 10 | BOOST_CHECK(correctPrimeNumbersSet == primeNumbers); 11 | } 12 | BOOST_AUTO_TEST_CASE(Start_value) 13 | { 14 | std::set primeNumbers = GeneratePrimeNumbersSet(0); 15 | std::set correctSet; 16 | BOOST_CHECK(correctSet == primeNumbers); 17 | primeNumbers = GeneratePrimeNumbersSet(1); 18 | BOOST_CHECK(correctSet == primeNumbers); 19 | primeNumbers = GeneratePrimeNumbersSet(2); 20 | correctSet.insert(2); 21 | BOOST_CHECK(correctSet == primeNumbers); 22 | } 23 | BOOST_AUTO_TEST_CASE(Prime_end_number) 24 | { 25 | std::set primeNumbers = GeneratePrimeNumbersSet(19); 26 | BOOST_CHECK(correctPrimeNumbersSet == primeNumbers); 27 | } 28 | BOOST_AUTO_TEST_SUITE_END() 29 | BOOST_AUTO_TEST_SUITE_END() -------------------------------------------------------------------------------- /lab2/PrimeNumbers/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab2/task1/task1/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : task1 Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this task1 application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your task1 application. 9 | 10 | 11 | task1.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | task1.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | task1.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named task1.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab2/task1/task1/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" -------------------------------------------------------------------------------- /lab2/task1/task1/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include -------------------------------------------------------------------------------- /lab2/task1/task1/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab2/task1/task1/task1.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "vector_utils.h" 3 | 4 | int main() 5 | { 6 | doubleVector processingVector = ReadVector(std::cin); 7 | ProcessVector(processingVector); 8 | PrintSortedVector(std::cout, processingVector); 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /lab2/task1/task1/task1.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab2/task1/task1/vector_utils.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "vector_utils.h" 3 | 4 | doubleVector ReadVector(std::istream & input) 5 | { 6 | double tempNumber; 7 | doubleVector tempVector; 8 | while (input >> tempNumber) 9 | { 10 | tempVector.push_back(tempNumber); 11 | } 12 | return tempVector; 13 | } 14 | 15 | double GetPositiveElementSumm(const doubleVector & processingVector) 16 | { 17 | double positiveElementSum = 0; 18 | for (auto element : processingVector) 19 | { 20 | if (element > 0) 21 | { 22 | positiveElementSum += element; 23 | } 24 | } 25 | return positiveElementSum; 26 | } 27 | 28 | void ProcessVector(doubleVector & processingVector) 29 | { 30 | double positiveElementSum = GetPositiveElementSumm(processingVector); 31 | bool isEven = true; 32 | for (auto & element : processingVector) 33 | { 34 | if (isEven) 35 | { 36 | element = element * 2; 37 | } 38 | else 39 | { 40 | element -= positiveElementSum; 41 | } 42 | } 43 | } 44 | 45 | void PrintSortedVector(std::ostream & output, doubleVector & printingVector) 46 | { 47 | std::sort(printingVector.begin(), printingVector.end(), [](double i, double j) { 48 | return i < j; 49 | }); 50 | for (const auto doubleNumb : printingVector) 51 | { 52 | output << doubleNumb << " "; 53 | } 54 | output << std::endl; 55 | } -------------------------------------------------------------------------------- /lab2/task1/task1/vector_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | typedef std::vector doubleVector; 5 | 6 | doubleVector ReadVector(std::istream & input); 7 | void ProcessVector(doubleVector & processingVector); 8 | void PrintSortedVector(std::ostream & output, doubleVector & printingVector); -------------------------------------------------------------------------------- /lab2/task1/test/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : test Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this test application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your test application. 9 | 10 | 11 | test.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | test.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | test.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named test.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab2/task1/test/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | //================================================= 4 | #include 5 | //================================================= -------------------------------------------------------------------------------- /lab2/task1/test/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | ///======================================= 17 | #define BOOST_TEST_MODULE UrlUtilsTests 18 | #define BOOST_TEST_INCLUDED 19 | #pragma warning (disable:4702) 20 | #include <./boost/test/unit_test.hpp> 21 | ///======================================= 22 | -------------------------------------------------------------------------------- /lab2/task1/test/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab2/task1/test/test.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "../task1/vector_utils.h" 3 | 4 | bool IsVectorsEquel(doubleVector vector1, doubleVector vector2) 5 | { 6 | for (size_t i = 0; i < vector1.size(); ++i) 7 | { 8 | if (vector1[i] != vector2[i]) 9 | { 10 | return false; 11 | } 12 | } 13 | return vector1.size() == vector2.size(); 14 | } 15 | 16 | BOOST_AUTO_TEST_SUITE(DoubleVectorTest) 17 | 18 | BOOST_AUTO_TEST_CASE(ReadCorrectVector) 19 | { 20 | std::stringstream strstream("123.3 123.4 123.5"); 21 | doubleVector correctVector = { 123.3, 123.4, 123.5 }; 22 | doubleVector processingVector = { 123.3, 123.4, 123.5 }; 23 | doubleVector readingVector = ReadVector(strstream); 24 | BOOST_CHECK(IsVectorsEquel(readingVector, correctVector)); 25 | } 26 | 27 | 28 | BOOST_AUTO_TEST_CASE(ProcessVectorTest) 29 | { 30 | doubleVector correctVector = { -12, -10, 4, 8 }; 31 | doubleVector processingVector = { 2, -6, 4, -5 }; 32 | ProcessVector(processingVector); 33 | PrintSortedVector(std::cout, processingVector); 34 | BOOST_CHECK(IsVectorsEquel(processingVector, correctVector)); 35 | } 36 | 37 | BOOST_AUTO_TEST_SUITE_END() -------------------------------------------------------------------------------- /lab2/task1/test/test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab2/translator/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab2/translator/tests/dictinary1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab2/translator/tests/dictinary1.txt -------------------------------------------------------------------------------- /lab2/translator/tests/dictionary.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab2/translator/tests/dictionary.txt -------------------------------------------------------------------------------- /lab2/translator/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | //================================================= 4 | #include 5 | //================================================= -------------------------------------------------------------------------------- /lab2/translator/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | ///======================================= 15 | #define BOOST_TEST_MODULE UrlUtilsTests 16 | #define BOOST_TEST_INCLUDED 17 | #pragma warning (disable:4702) 18 | #include <./boost/test/unit_test.hpp> 19 | ///======================================= -------------------------------------------------------------------------------- /lab2/translator/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab2/translator/tests/tests.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab2/translator/tests/tests.cpp -------------------------------------------------------------------------------- /lab2/translator/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab2/translator/translator/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : translator Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this translator application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your translator application. 9 | 10 | 11 | translator.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | translator.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | translator.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named translator.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab2/translator/translator/Translator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | typedef std::map Dictionary; 7 | 8 | class CTranslator 9 | { 10 | public: 11 | bool IsModified() const; 12 | void FillDictionary(std::istream & input); 13 | void AddTranslation(const std::string word, const std::string translation); 14 | Dictionary GetDictionary(); 15 | std::string GetTranslation(const std::string word) const; 16 | void DumpDictionary(std::ostream & output) const; 17 | private: 18 | bool m_modified = false; 19 | Dictionary m_dictionary; 20 | }; 21 | -------------------------------------------------------------------------------- /lab2/translator/translator/TranslatorImpl.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Translator.h" 3 | 4 | void CTranslator::FillDictionary(std::istream & input) 5 | { 6 | std::string word; 7 | std::string translation; 8 | m_modified = true; 9 | while (std::getline(input, word) && std::getline(input, translation)) 10 | { 11 | AddTranslation(word, translation); 12 | m_modified = false; 13 | } 14 | } 15 | 16 | std::string ToLowCase(std::string str) 17 | { 18 | std::locale loc; 19 | for (auto & ch : str) 20 | { 21 | ch = std::tolower(ch, loc); 22 | } 23 | return str; 24 | } 25 | 26 | bool CTranslator::IsModified() const 27 | { 28 | return m_modified; 29 | } 30 | 31 | void CTranslator::AddTranslation(const std::string word, const std::string translation) 32 | { 33 | m_dictionary[ToLowCase(word)] = ToLowCase(translation); 34 | m_dictionary[ToLowCase(translation)] = ToLowCase(word); 35 | m_modified = true; 36 | } 37 | 38 | 39 | std::string CTranslator::GetTranslation(const std::string word) const 40 | { 41 | auto it = m_dictionary.find(ToLowCase(word)); 42 | return it == m_dictionary.end() ? "" : it->second; 43 | } 44 | 45 | void CTranslator::DumpDictionary(std::ostream & output) const 46 | { 47 | Dictionary temp(m_dictionary); 48 | for (auto it = temp.begin(); it != temp.end(); ++it) 49 | { 50 | temp.erase(temp.find(it->second)); 51 | output << it->first << std::endl << it->second << std::endl; 52 | } 53 | } 54 | 55 | 56 | Dictionary CTranslator::GetDictionary() 57 | { 58 | Dictionary dictionary; 59 | for (auto it = m_dictionary.begin(); it != m_dictionary.end(); ++it) 60 | { 61 | dictionary[it->first] = it->second; 62 | } 63 | return move(dictionary); 64 | } -------------------------------------------------------------------------------- /lab2/translator/translator/dictionary.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab2/translator/translator/dictionary.txt -------------------------------------------------------------------------------- /lab2/translator/translator/input_output_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include "Translator.h" 4 | 5 | const std::string END_STR = "..."; 6 | const std::string AGREE_STATMENT = "Yes"; 7 | const std::string DISAGREE_STATMENT = "NO"; 8 | 9 | bool OpenFile(std::ofstream & output, std::string fileName); 10 | bool OpenFile(std::ifstream & output, std::string fileName); 11 | bool CheckArgumentCount(int argumentCount, std::string programName); 12 | void AskForTranslation(CTranslator & translator, const std::string & word); 13 | void DumpTranslator(const CTranslator & translator, std::ofstream & output); -------------------------------------------------------------------------------- /lab2/translator/translator/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" -------------------------------------------------------------------------------- /lab2/translator/translator/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include -------------------------------------------------------------------------------- /lab2/translator/translator/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab2/translator/translator/translator.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Translator.h" 3 | #include "input_output_utils.h" 4 | 5 | int main(int argc, char * argv[]) 6 | { 7 | CTranslator translator; 8 | std::ifstream input; 9 | std::ofstream output; 10 | if (CheckArgumentCount(argc, argv[0]) || 11 | !(OpenFile(input, argv[1])) || 12 | !(OpenFile(output, argv[2]))) 13 | { 14 | return 1; 15 | } 16 | translator.FillDictionary(input); 17 | std::string line; 18 | std::getline(std::cin, line); 19 | while (line != END_STR) 20 | { 21 | std::string translation = translator.GetTranslation(line); 22 | if (translation != "") 23 | { 24 | std::cout << translation << std::endl; 25 | } 26 | else 27 | { 28 | AskForTranslation(translator, line); 29 | } 30 | std::getline(std::cin, line); 31 | } 32 | DumpTranslator(translator, output); 33 | return 0; 34 | } -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/CValueHolder.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "CValueHolder.h" 3 | 4 | double CValueHolder::GetValue() const 5 | { 6 | return m_value; 7 | } -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/CValueHolder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "constants.h" 7 | 8 | class CValueHolder 9 | { 10 | public: 11 | double GetValue() const; 12 | ~CValueHolder() = default; 13 | protected: 14 | double m_value; 15 | }; -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/Calculator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class CValueHolder; 9 | class CFunction; 10 | class CVariable; 11 | 12 | class CCalculator 13 | { 14 | public: 15 | std::shared_ptr GetElement(const std::string & ident) const; 16 | void AddVariable(const std::string & name, const double & value = NAN); 17 | void AddVariable(const std::string & name, const std::string & ident); 18 | void AddFunction(const std::string & name, const std::string & firstArgumentIdent, const std::string & secondArgumentIdent = "", const std::string & operation = "+"); 19 | void SetVariableValue(const std::string & name, const double & value = NAN); 20 | void SetVariableValue(const std::string & name, const std::string & ident); 21 | std::map> GetVars() const; 22 | std::map> GetFuncs() const; 23 | ~CCalculator(); 24 | private: 25 | std::vector> CCalculator::GetDependentVariablesList(const std::string & ident) const; 26 | void CheckIdentifire(const std::string & ident); 27 | std::map> m_functions; 28 | std::map> m_variables; 29 | }; -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/Function.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Function.h" 3 | #include "Variable.h" 4 | 5 | CFunction::CFunction(const std::vector> & dependentVariables, const std::shared_ptr & argument1, const std::shared_ptr & argument2, const std::string & operation) 6 | : m_dependentVariables(dependentVariables), 7 | m_operation(operation) 8 | { 9 | m_arguments.first = argument1; 10 | m_arguments.second = argument2; 11 | Calc(); 12 | } 13 | 14 | void CFunction::Calc() 15 | { 16 | if (m_arguments.second == nullptr) 17 | { 18 | m_value = m_arguments.first->GetValue(); 19 | } 20 | else 21 | { 22 | m_value = OPERATIONS.at(m_operation)(m_arguments.first->GetValue(), m_arguments.second->GetValue()); 23 | } 24 | } 25 | 26 | void CFunction::Clear() 27 | { 28 | m_dependentVariables.clear(); 29 | m_arguments.first = nullptr; 30 | m_arguments.second = nullptr; 31 | } 32 | 33 | std::vector> CFunction::GetDependentVariables() 34 | { 35 | return m_dependentVariables; 36 | } 37 | -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/Function.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "CValueHolder.h" 7 | 8 | class CVariable; 9 | 10 | class CFunction : public CValueHolder 11 | { 12 | public: 13 | CFunction() = delete; 14 | CFunction(const std::vector> & dependentVariables, const std::shared_ptr & argument1, const std::shared_ptr & argument2, const std::string & operation); 15 | std::vector> GetDependentVariables(); 16 | void Clear(); 17 | void Calc(); 18 | private: 19 | std::vector> m_dependentVariables; 20 | std::pair, std::shared_ptr> m_arguments; 21 | std::string m_operation; 22 | }; -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/Variable.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Variable.h" 3 | #include "Function.h" 4 | 5 | void CVariable::SetValue(double value) 6 | { 7 | m_value = value; 8 | for (auto element : m_dependentFunctions) 9 | { 10 | element->Calc(); 11 | } 12 | } 13 | 14 | void CVariable::AppendDependentFunctions(const std::shared_ptr & function) 15 | { 16 | m_dependentFunctions.push_back(function); 17 | } -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/Variable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "CValueHolder.h" 5 | #include "constants.h" 6 | 7 | class CFunction; 8 | 9 | class CVariable : public CValueHolder 10 | { 11 | public: 12 | CVariable() = default; 13 | void SetValue(double value); 14 | void AppendDependentFunctions(const std::shared_ptr & function); 15 | private: 16 | std::vector> m_dependentFunctions; 17 | }; -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/calculate_prog.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Calculator.h" 3 | #include "Menu.h" 4 | #include "calculator_utils.h" 5 | 6 | int main() 7 | { 8 | CCalculator calculator; 9 | CMenu menu; 10 | menu.AddItem("help", "Give information about command", [&menu](CCalculator &, const std::string &) 11 | { 12 | menu.ShowInstructions(); 13 | }); 14 | menu.AddItem("exit", "Exit from programm", [&menu](CCalculator &, const std::string &) 15 | { 16 | menu.Exit(); 17 | }); 18 | menu.AddItem("var", " : Create new variable", ExecuteVar); 19 | menu.AddItem("let", " = | : Create new variable and set value, or just set value", ExecuteLet); 20 | menu.AddItem("fn", " = [+|-|*|/ ]> : Create new function", ExecuteFn); 21 | menu.AddItem("print", " : Print element value", ExecutePrint); 22 | menu.AddItem("printvars", " : Print all variables value", ExecutePrintVars); 23 | menu.AddItem("printfns", " : Print all functions value", ExecutePrintFns); 24 | menu.Run(calculator); 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/calculator_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "Calculator.h" 5 | 6 | std::vector GetIdents(const std::string & str); 7 | std::vector GetNumbers(const std::string & str); 8 | void ExecuteVar(CCalculator & calculator, const std::string & params); 9 | void ExecuteLet(CCalculator & calculator, const std::string & params); 10 | void ExecuteFn(CCalculator & calculator, const std::string & params); 11 | void ExecutePrint(const CCalculator & calculator, const std::string & params); 12 | void ExecutePrintFns(const CCalculator & calculator, const std::string & params); 13 | void ExecutePrintVars(const CCalculator & calculator, const std::string & params); -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/constants.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | const std::map> OPERATIONS = { 8 | { "+", [](double a, double b) -> double { return a + b; } }, 9 | { "-", [](double a, double b) -> double { return a - b; } }, 10 | { "*", [](double a, double b) -> double { return a * b; } }, 11 | { "/", [](double a, double b) -> double { return a / b; } }, 12 | }; -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/print_utils.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "print_utils.h" 3 | #include "CValueHolder.h" 4 | #include "Function.h" 5 | #include "Variable.h" 6 | 7 | 8 | void PrintElement(std::ostream & output, const CCalculator & calc, const std::string & name) 9 | { 10 | auto element = calc.GetElement(name); 11 | if (element != nullptr) 12 | { 13 | output << std::fixed; 14 | output << std::setprecision(2); 15 | double value = element->GetValue(); 16 | if (isnan(value)) 17 | { 18 | output << name << ":nan" << std::endl; 19 | } 20 | else 21 | { 22 | output << name << ":" << value << std::endl; 23 | } 24 | } 25 | else 26 | { 27 | throw std::invalid_argument("There are no variable or function with name " + name); 28 | } 29 | } 30 | 31 | void PrintFunctions(std::ostream & output, const CCalculator & calc) 32 | { 33 | output << std::fixed; 34 | output << std::setprecision(2); 35 | auto fns = calc.GetFuncs(); 36 | for (auto element : fns) 37 | { 38 | double value = element.second->GetValue(); 39 | if (isnan(value)) 40 | { 41 | output << element.first << ":nan" << std::endl; 42 | } 43 | else 44 | { 45 | output << element.first << ":" << value << std::endl; 46 | } 47 | } 48 | } 49 | 50 | void PrintVariables(std::ostream & output, const CCalculator & calc) 51 | { 52 | output << std::fixed; 53 | output << std::setprecision(2); 54 | auto vars = calc.GetVars(); 55 | for (auto element : vars) 56 | { 57 | double value = element.second->GetValue(); 58 | if (isnan(value)) 59 | { 60 | output << element.first << ":nan" << std::endl; 61 | } 62 | else 63 | { 64 | output << element.first << ":" << value << std::endl; 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/print_utils.h: -------------------------------------------------------------------------------- 1 | #include "Calculator.h" 2 | #include 3 | #include 4 | 5 | void PrintElement(std::ostream & output, const CCalculator & calc, const std::string & name); 6 | void PrintFunctions(std::ostream & output, const CCalculator & calc); 7 | void PrintVariables(std::ostream & output, const CCalculator & calc); -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include -------------------------------------------------------------------------------- /lab3/Calculator/Calculator/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | -------------------------------------------------------------------------------- /lab3/Calculator/tests/FnOut.txt: -------------------------------------------------------------------------------- 1 | fn1:1.00 2 | -------------------------------------------------------------------------------- /lab3/Calculator/tests/FnsOut.txt: -------------------------------------------------------------------------------- 1 | fn1:1.00 2 | fn2:1.00 3 | fn3:2.00 4 | fn4:2.00 5 | fnNan:nan 6 | -------------------------------------------------------------------------------- /lab3/Calculator/tests/NanOut.txt: -------------------------------------------------------------------------------- 1 | varNan:nan 2 | fnNan:nan 3 | -------------------------------------------------------------------------------- /lab3/Calculator/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab3/Calculator/tests/VarOut.txt: -------------------------------------------------------------------------------- 1 | var1:1.00 2 | -------------------------------------------------------------------------------- /lab3/Calculator/tests/VarsOut.txt: -------------------------------------------------------------------------------- 1 | var1:1.00 2 | var2:2.00 3 | varNan:nan 4 | -------------------------------------------------------------------------------- /lab3/Calculator/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define BOOST_TEST_NO_MAIN 4 | 5 | //================================================= 6 | #include 7 | //================================================= -------------------------------------------------------------------------------- /lab3/Calculator/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | ///======================================= 11 | #define BOOST_TEST_INCLUDED 12 | #pragma warning (disable:4702) 13 | #include 14 | ///======================================= 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include -------------------------------------------------------------------------------- /lab3/Calculator/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab3/Calculator/tests/tests_logger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab3/Calculator/tests/tests_logger.cpp -------------------------------------------------------------------------------- /lab3/carmodel/carmodel/Car.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | enum class GearType 5 | { 6 | noGear = -2, 7 | reverse = -1, 8 | neutral, 9 | low, 10 | second, 11 | third, 12 | fourth, 13 | fifth 14 | }; 15 | 16 | std::string GearToString(GearType gear); 17 | GearType StringToGear(std::string gear); 18 | 19 | class CCar 20 | { 21 | public: 22 | GearType GetGear() const; 23 | unsigned GetSpeed() const; 24 | int GetDirection() const; 25 | bool IsEngineOn() const; 26 | bool TurnEngineOn(); 27 | bool TurnEngineOff(); 28 | bool SetGear(GearType gear); 29 | bool SetSpeed(int speed); 30 | void PrintInfo(std::ostream & output) const; 31 | private: 32 | GearType m_currentGear = GearType::neutral; 33 | int m_speed = 0; 34 | bool m_engineOn = false; 35 | }; -------------------------------------------------------------------------------- /lab3/carmodel/carmodel/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : carmodel Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this carmodel application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your carmodel application. 9 | 10 | 11 | carmodel.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | carmodel.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | carmodel.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named carmodel.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab3/carmodel/carmodel/Sphere.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | -------------------------------------------------------------------------------- /lab3/carmodel/carmodel/carmodel.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | -------------------------------------------------------------------------------- /lab3/carmodel/carmodel/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // carmodel.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /lab3/carmodel/carmodel/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include -------------------------------------------------------------------------------- /lab3/carmodel/carmodel/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab3/carmodel/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab3/carmodel/tests/car_tests.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab3/carmodel/tests/car_tests.cpp -------------------------------------------------------------------------------- /lab3/carmodel/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define BOOST_TEST_NO_MAIN 4 | 5 | //================================================= 6 | #include 7 | //================================================= -------------------------------------------------------------------------------- /lab3/carmodel/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | ///======================================= 11 | #define BOOST_TEST_INCLUDED 12 | #pragma warning (disable:4702) 13 | #include 14 | ///======================================= 15 | 16 | #include 17 | #include 18 | #include 19 | #include -------------------------------------------------------------------------------- /lab3/carmodel/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab3/carmodel/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | -------------------------------------------------------------------------------- /lab4/Task1/Task1/Body.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Body.h" 3 | 4 | double CBody::GetMass() const 5 | { 6 | return GetDensity() * GetVolume(); 7 | } 8 | 9 | std::string CBody::NameToString() const 10 | { 11 | return "Body:"; 12 | } 13 | 14 | std::string CBody::FieldsToString() const 15 | { 16 | return ""; 17 | } 18 | 19 | bool CBody::IsCanAddedToCompound(CCompound *) const 20 | { 21 | return true; 22 | } 23 | 24 | bool CBody::SetParent(CCompound *) 25 | { 26 | return true; 27 | } 28 | 29 | std::string CBody::ToString() const 30 | { 31 | std::string result = NameToString(); 32 | result = result + " mass = " + std::to_string(GetMass()) + ","; 33 | result = result + " density = " + std::to_string(GetDensity()) + ","; 34 | result = result + " volume = " + std::to_string(GetVolume()); 35 | result = result + FieldsToString(); 36 | return result; 37 | } -------------------------------------------------------------------------------- /lab4/Task1/Task1/Body.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | class CCompound; 4 | class CBody; 5 | template 6 | class CEqualityComparable : virtual public Base 7 | { 8 | public: 9 | bool IsEqual(const CBody & body)const override 10 | { 11 | auto bodyAsT = dynamic_cast(&body); 12 | auto selfAsT = static_cast(this); 13 | return bodyAsT && *bodyAsT == *selfAsT; 14 | } 15 | virtual bool operator==(const T & rhs) const = 0; 16 | }; 17 | 18 | class CBody 19 | { 20 | public: 21 | virtual bool IsEqual(const CBody & body) const = 0; 22 | virtual double GetVolume() const = 0; 23 | virtual double GetMass() const; 24 | virtual double GetDensity() const = 0; 25 | virtual bool SetParent(CCompound * compound = nullptr); 26 | virtual bool IsCanAddedToCompound(CCompound * compound = nullptr) const; 27 | virtual std::string ToString() const; 28 | virtual ~CBody() {}; 29 | protected: 30 | virtual std::string NameToString() const; 31 | virtual std::string FieldsToString() const; 32 | }; -------------------------------------------------------------------------------- /lab4/Task1/Task1/Compound.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "Body.h" 4 | class CCompound : public CEqualityComparable 5 | { 6 | public: 7 | double GetVolume() const override; 8 | double GetMass() const override; 9 | double GetDensity() const override; 10 | bool AddChild(const std::shared_ptr & childBody); 11 | bool IsEmpty() const; 12 | bool HasEqual(CBody * child) const; 13 | size_t GetChildCount() const; 14 | bool operator==(const CCompound & arg) const; 15 | CCompound * GetParent() const; 16 | bool SetParent(CCompound * compound) override; 17 | bool IsCanAddedToCompound(CCompound * compound) const override; 18 | protected: 19 | std::string NameToString() const override; 20 | std::string FieldsToString() const override; 21 | private: 22 | CCompound * m_parent; 23 | std::vector> m_children; 24 | double m_volume = 0; 25 | double m_mass = 0; 26 | 27 | }; -------------------------------------------------------------------------------- /lab4/Task1/Task1/Cone.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Cone.h" 3 | 4 | 5 | double CCone::GetHeight() const 6 | { 7 | return m_height; 8 | } 9 | 10 | double CCone::GetBaseRadius() const 11 | { 12 | return m_baseRadius; 13 | } 14 | 15 | double CCone::GetVolume() const 16 | { 17 | return m_baseRadius * m_baseRadius * M_PI * m_height / 3; 18 | } 19 | 20 | CCone::CCone(double density, double baseRadius, double height) 21 | :m_baseRadius(baseRadius), m_height(height) 22 | { 23 | if (baseRadius <= 0) 24 | { 25 | throw std::invalid_argument("Can not to create cone with negative base radius"); 26 | } 27 | if (height <= 0) 28 | { 29 | throw std::invalid_argument("Can not to create cone with negative base height"); 30 | } 31 | if (density <= 0) 32 | { 33 | throw std::invalid_argument("Can not to create cone with negative density"); 34 | } 35 | m_density = density; 36 | } 37 | 38 | std::string CCone::NameToString() const 39 | { 40 | return "Cone:"; 41 | } 42 | 43 | std::string CCone::FieldsToString() const 44 | { 45 | std::string result; 46 | result = result + ", base radius = " + std::to_string(GetBaseRadius()) + ","; 47 | result = result + " height = " + std::to_string(GetHeight()); 48 | return result; 49 | } 50 | 51 | bool CCone::operator==(const CCone & arg) const 52 | { 53 | return (arg.GetDensity() == GetDensity()) && 54 | (arg.GetMass() == GetMass()) && 55 | (arg.GetVolume() == GetVolume()) && 56 | (arg.GetBaseRadius() == GetBaseRadius()) && 57 | (arg.GetHeight() == GetHeight()); 58 | } -------------------------------------------------------------------------------- /lab4/Task1/Task1/Cone.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Body.h" 3 | #include "SolidBody.h" 4 | class CCone : 5 | public CEqualityComparable 6 | { 7 | public: 8 | CCone() = delete; 9 | CCone(double density, double baseRadius, double height); 10 | double GetVolume() const; 11 | double GetHeight() const; 12 | double GetBaseRadius() const; 13 | bool operator==(const CCone & arg) const; 14 | protected: 15 | std::string NameToString() const override; 16 | std::string FieldsToString() const override; 17 | private: 18 | double m_height = NAN; 19 | double m_baseRadius = NAN; 20 | }; -------------------------------------------------------------------------------- /lab4/Task1/Task1/Cylinder.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Cylinder.h" 3 | 4 | 5 | double CCylinder::GetHeight() const 6 | { 7 | return m_height; 8 | } 9 | 10 | double CCylinder::GetBaseRadius() const 11 | { 12 | return m_baseRadius; 13 | } 14 | 15 | double CCylinder::GetVolume() const 16 | { 17 | return m_baseRadius * m_baseRadius * M_PI * m_height * 2; 18 | } 19 | 20 | CCylinder::CCylinder(double density, double baseRadius, double height) 21 | :m_baseRadius(baseRadius), m_height(height) 22 | { 23 | if (baseRadius <= 0) 24 | { 25 | throw std::invalid_argument("Can not to create cylinder with negative base radius"); 26 | } 27 | if (height <= 0) 28 | { 29 | throw std::invalid_argument("Can not to create cylinder with negative base height"); 30 | } 31 | if (density <= 0) 32 | { 33 | throw std::invalid_argument("Can not to create cylinder with negative density"); 34 | } 35 | m_density = density; 36 | } 37 | 38 | 39 | std::string CCylinder::NameToString() const 40 | { 41 | return "Cylinder:"; 42 | } 43 | 44 | std::string CCylinder::FieldsToString() const 45 | { 46 | std::string result; 47 | result = result + ", base radius = " + std::to_string(GetBaseRadius()) + ","; 48 | result = result + " height = " + std::to_string(GetHeight()); 49 | return result; 50 | } 51 | 52 | 53 | bool CCylinder::operator==(const CCylinder & arg) const 54 | { 55 | return (arg.GetDensity() == GetDensity()) && 56 | (arg.GetMass() == GetMass()) && 57 | (arg.GetVolume() == GetVolume()) && 58 | (arg.GetBaseRadius() == GetBaseRadius()) && 59 | (arg.GetHeight() == GetHeight()); 60 | } -------------------------------------------------------------------------------- /lab4/Task1/Task1/Cylinder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Body.h" 3 | #include "SolidBody.h" 4 | 5 | class CCylinder : 6 | public CEqualityComparable 7 | { 8 | public: 9 | CCylinder() = delete; 10 | CCylinder(double density, double baseRadius, double height); 11 | double GetVolume() const; 12 | double GetHeight() const; 13 | double GetBaseRadius() const; 14 | bool operator==(const CCylinder & arg) const; 15 | protected: 16 | std::string NameToString() const override; 17 | std::string FieldsToString() const override; 18 | private: 19 | double m_height = NAN; 20 | double m_baseRadius = NAN; 21 | }; -------------------------------------------------------------------------------- /lab4/Task1/Task1/Parallelepiped.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Body.h" 3 | #include "SolidBody.h" 4 | 5 | class CParallelepiped : 6 | public CEqualityComparable 7 | { 8 | public: 9 | CParallelepiped() = delete; 10 | CParallelepiped(double density, double width, double height, double depth); 11 | double GetVolume() const; 12 | double GetHeight() const; 13 | double GetWidth() const; 14 | double GetDepth() const; 15 | bool operator==(const CParallelepiped & arg) const; 16 | protected: 17 | std::string NameToString() const override; 18 | std::string FieldsToString() const override; 19 | private: 20 | double m_width = NAN; 21 | double m_height = NAN; 22 | double m_depth = NAN; 23 | }; -------------------------------------------------------------------------------- /lab4/Task1/Task1/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : Task1 Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this Task1 application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your Task1 application. 9 | 10 | 11 | Task1.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | Task1.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | Task1.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named Task1.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab4/Task1/Task1/SolidBody.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Body.h" 3 | 4 | class CSolidBody : public CBody 5 | { 6 | public: 7 | double GetDensity() const override 8 | { 9 | return m_density; 10 | } 11 | protected: 12 | double m_density = NAN; 13 | }; -------------------------------------------------------------------------------- /lab4/Task1/Task1/Sphere.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Sphere.h" 3 | 4 | double CSphere::GetRadius() const 5 | { 6 | return m_radius; 7 | } 8 | 9 | 10 | double CSphere::GetVolume() const 11 | { 12 | return 4 * m_radius * m_radius * m_radius * M_PI / 3; 13 | } 14 | 15 | CSphere::CSphere(double density, double radius) 16 | :m_radius(radius) 17 | { 18 | if (radius <= 0) 19 | { 20 | throw std::invalid_argument("Can not to create sphere with negative radius"); 21 | } 22 | if (density <= 0) 23 | { 24 | throw std::invalid_argument("Can not to create sphere with negative density"); 25 | } 26 | m_density = density; 27 | } 28 | 29 | std::string CSphere::NameToString() const 30 | { 31 | return "Sphere:"; 32 | } 33 | 34 | std::string CSphere::FieldsToString() const 35 | { 36 | return ", radius = " + std::to_string(GetRadius()); 37 | } 38 | 39 | bool CSphere::operator==(const CSphere & arg) const 40 | { 41 | return (arg.GetDensity() == GetDensity()) && 42 | (arg.GetMass() == GetMass()) && 43 | (arg.GetVolume() == GetVolume()) && 44 | (arg.GetRadius() == GetRadius()); 45 | } -------------------------------------------------------------------------------- /lab4/Task1/Task1/Sphere.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Body.h" 3 | #include "SolidBody.h" 4 | 5 | class CSphere : 6 | public CEqualityComparable 7 | { 8 | public: 9 | CSphere() = delete; 10 | CSphere(double density, double radius); 11 | double GetVolume() const; 12 | double GetRadius() const; 13 | bool operator==(const CSphere & arg) const; 14 | protected: 15 | std::string NameToString() const override; 16 | std::string FieldsToString() const override; 17 | private: 18 | double m_radius = NAN; 19 | }; -------------------------------------------------------------------------------- /lab4/Task1/Task1/Task1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab4/Task1/Task1/Task1.cpp -------------------------------------------------------------------------------- /lab4/Task1/Task1/body_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "Body.h" 5 | #include "Compound.h" 6 | #include "Cone.h" 7 | #include "Cylinder.h" 8 | #include "Parallelepiped.h" 9 | #include "Sphere.h" 10 | 11 | const std::string DOUBLE_PATTERN = "(\\d+(\\.\\d+)?)"; 12 | const std::string END_COMPOUND_STR = "End compound"; 13 | 14 | std::shared_ptr GetSimpleBody(std::string body); 15 | std::shared_ptr GetCone(const std::string & cone); 16 | std::shared_ptr GetCylinder(const std::string & cylinder); 17 | std::shared_ptr GetParallelepiped(const std::string & parallelepiped); 18 | std::shared_ptr GetSphere(const std::string & sphere); 19 | std::shared_ptr GetCompound(std::istream & compound, std::ostream & errorStream); 20 | 21 | std::shared_ptr GetHeaviestBody(const std::vector> & bodyVector); 22 | std::shared_ptr GetEasiestBody(const std::vector> & bodyVector); -------------------------------------------------------------------------------- /lab4/Task1/Task1/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | -------------------------------------------------------------------------------- /lab4/Task1/Task1/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define _USE_MATH_DEFINES 3 | 4 | #include "targetver.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include -------------------------------------------------------------------------------- /lab4/Task1/Task1/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab4/Task1/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab4/Task1/tests/compound_content_compound_body.txt: -------------------------------------------------------------------------------- 1 | Compound: 2 | Parallelepiped: density = 1, depth = 1, width = 1, height = 1 3 | Sphere: density = 1, radius = 2 4 | End compound 5 | End compound 6 | -------------------------------------------------------------------------------- /lab4/Task1/tests/compound_content_simple_body.txt: -------------------------------------------------------------------------------- 1 | Parallelepiped: density = 1, depth = 1, width = 1, height = 1 2 | Sphere: density = 1, radius = 2 3 | End compound 4 | -------------------------------------------------------------------------------- /lab4/Task1/tests/compund_to_string.txt: -------------------------------------------------------------------------------- 1 | Compound: 2 | mass = 34.510322, density = 1.000000, volume = 34.510322 3 | Parallelepiped: mass = 1.000000, density = 1.000000, volume = 1.000000, depth = 1.000000, width = 1.000000, height = 1.000000 4 | Sphere: mass = 33.510322, density = 1.000000, volume = 33.510322, radius = 2.000000 5 | -------------------------------------------------------------------------------- /lab4/Task1/tests/empty_compound_init.txt: -------------------------------------------------------------------------------- 1 | End compound 2 | -------------------------------------------------------------------------------- /lab4/Task1/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define BOOST_TEST_NO_MAIN 4 | #define BOOST_TEST_MODULE example 5 | //================================================= 6 | #include 7 | //================================================= 8 | -------------------------------------------------------------------------------- /lab4/Task1/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | ///======================================= 11 | #define BOOST_TEST_INCLUDED 12 | #pragma warning (disable:4702) 13 | #include 14 | ///======================================= 15 | 16 | #define _USE_MATH_DEFINES 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include -------------------------------------------------------------------------------- /lab4/Task1/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab4/Task1/tests/tests.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab4/Task1/tests/tests.h -------------------------------------------------------------------------------- /lab4/Task1/tests/tests_logger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab4/Task1/tests/tests_logger.cpp -------------------------------------------------------------------------------- /lab5/MyString/MyString/MyString.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab5/MyString/MyString/MyString.h -------------------------------------------------------------------------------- /lab5/MyString/MyString/MyString.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab5/MyString/MyString/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : MyString Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this MyString application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your MyString application. 9 | 10 | 11 | MyString.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | MyString.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | MyString.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named MyString.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab5/MyString/MyString/index.cpp: -------------------------------------------------------------------------------- 1 | // MyString.cpp : Defines the entry point for the console application. 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "MyString.h" 6 | 7 | int main() 8 | { 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /lab5/MyString/MyString/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // MyString.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /lab5/MyString/MyString/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include -------------------------------------------------------------------------------- /lab5/MyString/MyString/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab5/MyString/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab5/MyString/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define BOOST_TEST_NO_MAIN 4 | #define BOOST_TEST_MODULE example 5 | //================================================= 6 | #include 7 | //================================================= -------------------------------------------------------------------------------- /lab5/MyString/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | ///======================================= 11 | #define BOOST_TEST_INCLUDED 12 | #pragma warning (disable:4702) 13 | #include 14 | ///======================================= 15 | 16 | #include 17 | #include 18 | #include -------------------------------------------------------------------------------- /lab5/MyString/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | -------------------------------------------------------------------------------- /lab5/MyString/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | -------------------------------------------------------------------------------- /lab5/MyString/tests/tests_logger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab5/MyString/tests/tests_logger.cpp -------------------------------------------------------------------------------- /lab5/Rational/Rational/Rational.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab5/Rational/Rational/Rational.h -------------------------------------------------------------------------------- /lab5/Rational/Rational/Rational.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab5/Rational/Rational/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : Rational Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this Rational application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your Rational application. 9 | 10 | 11 | Rational.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | Rational.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | Rational.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named Rational.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab5/Rational/Rational/index.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | int main() 4 | { 5 | std::cout << boost::math::gcd(10, 0) << std::endl; 6 | return 0; 7 | } -------------------------------------------------------------------------------- /lab5/Rational/Rational/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" -------------------------------------------------------------------------------- /lab5/Rational/Rational/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include -------------------------------------------------------------------------------- /lab5/Rational/Rational/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | -------------------------------------------------------------------------------- /lab5/Rational/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab5/Rational/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define BOOST_TEST_NO_MAIN 4 | #define BOOST_TEST_MODULE example 5 | //================================================= 6 | #include 7 | //================================================= -------------------------------------------------------------------------------- /lab5/Rational/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | ///======================================= 11 | #define BOOST_TEST_INCLUDED 12 | #pragma warning (disable:4702) 13 | #include 14 | ///======================================= 15 | 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | -------------------------------------------------------------------------------- /lab5/Rational/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab5/Rational/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | -------------------------------------------------------------------------------- /lab5/Rational/tests/tests_logger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab5/Rational/tests/tests_logger.cpp -------------------------------------------------------------------------------- /lab6/StrigList/StrigList/StrigList.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab6/StrigList/StrigList/index.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "StringList.h" 3 | 4 | typedef int MyInt; 5 | 6 | int main() 7 | { 8 | return 0; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /lab6/StrigList/StrigList/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // StrigList.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /lab6/StrigList/StrigList/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include -------------------------------------------------------------------------------- /lab6/StrigList/StrigList/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab6/StrigList/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab6/StrigList/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define BOOST_TEST_NO_MAIN 4 | #define BOOST_TEST_MODULE example 5 | //================================================= 6 | #include 7 | //================================================= -------------------------------------------------------------------------------- /lab6/StrigList/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | ///======================================= 11 | #define BOOST_TEST_INCLUDED 12 | #pragma warning (disable:4702) 13 | #include 14 | ///======================================= 15 | 16 | #include -------------------------------------------------------------------------------- /lab6/StrigList/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab6/StrigList/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | -------------------------------------------------------------------------------- /lab6/StrigList/tests/tests_logger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab6/StrigList/tests/tests_logger.cpp -------------------------------------------------------------------------------- /lab6/http_url/http_url/HttpUrl.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab6/http_url/http_url/HttpUrl.h -------------------------------------------------------------------------------- /lab6/http_url/http_url/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : http_url Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this http_url application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your http_url application. 9 | 10 | 11 | http_url.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | http_url.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | http_url.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named http_url.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab6/http_url/http_url/UrlParsingError.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "UrlParsingError.h" 3 | -------------------------------------------------------------------------------- /lab6/http_url/http_url/UrlParsingError.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | class CUrlParsingError : public std::invalid_argument 6 | { 7 | public: 8 | explicit CUrlParsingError(const std::string & url) : std::invalid_argument(url) {}; 9 | explicit CUrlParsingError::CUrlParsingError(const char * url) : std::invalid_argument(url) {}; 10 | }; -------------------------------------------------------------------------------- /lab6/http_url/http_url/http_url.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "HttpUrl.h" 3 | #include "UrlParsingError.h" 4 | 5 | int main() 6 | { 7 | std::string urlStr; 8 | while (std::getline(std::cin, urlStr)) 9 | { 10 | try 11 | { 12 | CHttpUrl url(urlStr); 13 | std::cout << url.ToString() << std::endl; 14 | } 15 | catch (CUrlParsingError & err) 16 | { 17 | std::cout << err.what() << std::endl; 18 | } 19 | } 20 | return 0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /lab6/http_url/http_url/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" -------------------------------------------------------------------------------- /lab6/http_url/http_url/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include -------------------------------------------------------------------------------- /lab6/http_url/http_url/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | -------------------------------------------------------------------------------- /lab6/http_url/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab6/http_url/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define BOOST_TEST_NO_MAIN 4 | #define BOOST_TEST_MODULE example 5 | //================================================= 6 | #include 7 | //================================================= -------------------------------------------------------------------------------- /lab6/http_url/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | ///======================================= 11 | #define BOOST_TEST_INCLUDED 12 | #pragma warning (disable:4702) 13 | #include 14 | ///======================================= 15 | 16 | #include 17 | #include 18 | #include -------------------------------------------------------------------------------- /lab6/http_url/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab6/http_url/tests/tests.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab6/http_url/tests/tests.cpp -------------------------------------------------------------------------------- /lab6/http_url/tests/tests_logger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab6/http_url/tests/tests_logger.cpp -------------------------------------------------------------------------------- /lab7/MyList/MyList/MyList.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /lab7/MyList/MyList/index.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "MyList.h" 3 | #include 4 | 5 | typedef int MyInt; 6 | class CExample 7 | { 8 | public: 9 | CExample(int a) 10 | : a(a) {}; 11 | public: 12 | int a; 13 | }; 14 | 15 | 16 | int main() 17 | { 18 | CMyList a; 19 | a.PushBack(CExample(1)); 20 | auto it = a.begin(); 21 | return 0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /lab7/MyList/MyList/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // StrigList.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /lab7/MyList/MyList/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include -------------------------------------------------------------------------------- /lab7/MyList/MyList/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | -------------------------------------------------------------------------------- /lab7/MyList/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab7/MyList/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define BOOST_TEST_NO_MAIN 4 | #define BOOST_TEST_MODULE example 5 | //================================================= 6 | #include 7 | //================================================= -------------------------------------------------------------------------------- /lab7/MyList/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | ///======================================= 11 | #define BOOST_TEST_INCLUDED 12 | #pragma warning (disable:4702) 13 | #include 14 | ///======================================= 15 | 16 | #include -------------------------------------------------------------------------------- /lab7/MyList/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab7/MyList/tests/tests.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab7/MyList/tests/tests.cpp -------------------------------------------------------------------------------- /lab7/MyList/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab7/MyList/tests/tests_logger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab7/MyList/tests/tests_logger.cpp -------------------------------------------------------------------------------- /lab7/find_max_ex/find_max_ex/find_max_ex.cpp: -------------------------------------------------------------------------------- 1 | // find_max_ex.cpp : Defines the entry point for the console application. 2 | // 3 | 4 | #include "stdafx.h" 5 | 6 | 7 | int main() 8 | { 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /lab7/find_max_ex/find_max_ex/find_max_ex.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /lab7/find_max_ex/find_max_ex/find_max_func.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template < typename T, typename Less = std::less> 4 | bool FindMax(const std::vector & arr, T & maxValue, const Less & less = Less()) 5 | { 6 | if (arr.empty()) 7 | { 8 | return false; 9 | } 10 | maxValue = *arr.begin(); 11 | for (const T & el : arr) 12 | { 13 | if (less(maxValue, el)) 14 | { 15 | maxValue = el; 16 | } 17 | } 18 | return true; 19 | } 20 | -------------------------------------------------------------------------------- /lab7/find_max_ex/find_max_ex/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // find_max_ex.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /lab7/find_max_ex/find_max_ex/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | 13 | 14 | 15 | // TODO: reference additional headers your program requires here 16 | -------------------------------------------------------------------------------- /lab7/find_max_ex/find_max_ex/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab7/find_max_ex/tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your tests application. 9 | 10 | 11 | tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /lab7/find_max_ex/tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define BOOST_TEST_NO_MAIN 4 | #define BOOST_TEST_MODULE example 5 | //================================================= 6 | #include 7 | //================================================= 8 | -------------------------------------------------------------------------------- /lab7/find_max_ex/tests/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | ///======================================= 11 | #define BOOST_TEST_INCLUDED 12 | #pragma warning (disable:4702) 13 | #include 14 | ///======================================= -------------------------------------------------------------------------------- /lab7/find_max_ex/tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /lab7/find_max_ex/tests/tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /lab7/find_max_ex/tests/tests_logger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Inexpediency/cpp-practice/3c1331c0198b901e47a1c6ef2fef1c2ca65262cb/lab7/find_max_ex/tests/tests_logger.cpp --------------------------------------------------------------------------------