├── Lesson11 ├── problem_93 │ ├── sample.txt │ ├── CMakeLists.txt │ └── main.cpp ├── problem_94 │ ├── sample.txt │ └── CMakeLists.txt ├── problem_88 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_89 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_90 │ └── CMakeLists.txt ├── problem_91 │ ├── CMakeLists.txt │ └── main.cpp └── problem_92 │ ├── CMakeLists.txt │ └── main.cpp ├── Lesson04 ├── problem_34 │ ├── sample34.txt │ ├── CMakeLists.txt │ └── main.cpp ├── problem_32 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_33 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_35 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_36 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_37 │ ├── CMakeLists.txt │ └── main.cpp └── problem_38 │ ├── CMakeLists.txt │ └── main.cpp ├── Lesson10 ├── problem_79 │ ├── sample79.zip │ ├── CMakeLists.txt │ └── main.cpp ├── problem_85 │ ├── cppchallenger85.db │ ├── CMakeLists.txt │ ├── moviesdb.sql │ └── main.cpp ├── problem_86 │ ├── cppchallenger86.db │ └── CMakeLists.txt ├── problem_87 │ ├── cppchallenger87.db │ ├── res │ │ ├── the_matrix.jpg │ │ └── forrest_gump.jpg │ ├── moviesdb.sql │ └── CMakeLists.txt ├── problem_82 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_83 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_84 │ └── CMakeLists.txt ├── problem_80 │ ├── CMakeLists.txt │ └── main.cpp └── problem_81 │ └── CMakeLists.txt ├── Lesson09 ├── problem_78 │ ├── res │ │ ├── Einstein1.jpg │ │ ├── Einstein2.jpg │ │ ├── Einstein3.jpg │ │ └── Einstein4.jpg │ ├── CMakeLists.txt │ └── main.cpp ├── problem_74 │ ├── CMakeLists.txt │ ├── movies.xml │ └── main.cpp ├── problem_75 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_76 │ ├── CMakeLists.txt │ ├── movies.json │ └── main.cpp ├── problem_73 │ ├── CMakeLists.txt │ └── main.cpp └── problem_77 │ └── CMakeLists.txt ├── Lesson12 ├── problem_9a │ ├── res │ │ └── albert_and_elsa.jpg │ └── CMakeLists.txt ├── problem_95 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_96c │ ├── CMakeLists.txt │ └── main.cpp ├── problem_96s │ ├── CMakeLists.txt │ └── main.cpp ├── problem_98 │ └── CMakeLists.txt ├── problem_99 │ ├── CMakeLists.txt │ └── main.cpp └── problem_97 │ ├── CMakeLists.txt │ └── main.cpp ├── Lesson01 ├── problem_01 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_02 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_03 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_04 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_05 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_06 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_07 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_08 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_09 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_10 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_11 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_12 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_13 │ ├── CMakeLists.txt │ └── main.cpp └── problem_14 │ ├── CMakeLists.txt │ └── main.cpp ├── Lesson02 ├── problem_15 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_16 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_17 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_18 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_19 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_20 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_21 │ └── CMakeLists.txt └── problem_22 │ └── CMakeLists.txt ├── Lesson03 ├── problem_23 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_24 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_25 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_26 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_27 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_28 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_29 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_31 │ ├── CMakeLists.txt │ └── main.cpp └── problem_30 │ ├── CMakeLists.txt │ └── main.cpp ├── Lesson05 ├── problem_39 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_40 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_41 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_42 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_44 │ ├── CMakeLists.txt │ └── main.cpp └── problem_43 │ ├── CMakeLists.txt │ └── main.cpp ├── Lesson07 ├── problem_61 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_62 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_63 │ └── CMakeLists.txt ├── problem_64 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_65 │ ├── CMakeLists.txt │ └── main.cpp └── problem_66 │ └── CMakeLists.txt ├── Lesson08 ├── problem_67 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_68 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_69 │ └── CMakeLists.txt ├── problem_70 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_71 │ └── CMakeLists.txt └── problem_72 │ └── CMakeLists.txt ├── Lesson06 ├── problem_45 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_46 │ └── CMakeLists.txt ├── problem_47 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_48 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_49 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_50 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_51 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_52 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_53 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_54 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_55 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_56 │ ├── CMakeLists.txt │ └── main.cpp ├── problem_57 │ └── CMakeLists.txt ├── problem_58 │ └── CMakeLists.txt ├── problem_59 │ ├── CMakeLists.txt │ └── main.cpp └── problem_60 │ └── CMakeLists.txt ├── LICENSE └── README.md /Lesson11/problem_93/sample.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson11/problem_93/sample.txt -------------------------------------------------------------------------------- /Lesson11/problem_94/sample.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson11/problem_94/sample.txt -------------------------------------------------------------------------------- /Lesson04/problem_34/sample34.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson04/problem_34/sample34.txt -------------------------------------------------------------------------------- /Lesson10/problem_79/sample79.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson10/problem_79/sample79.zip -------------------------------------------------------------------------------- /Lesson09/problem_78/res/Einstein1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson09/problem_78/res/Einstein1.jpg -------------------------------------------------------------------------------- /Lesson09/problem_78/res/Einstein2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson09/problem_78/res/Einstein2.jpg -------------------------------------------------------------------------------- /Lesson09/problem_78/res/Einstein3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson09/problem_78/res/Einstein3.jpg -------------------------------------------------------------------------------- /Lesson09/problem_78/res/Einstein4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson09/problem_78/res/Einstein4.jpg -------------------------------------------------------------------------------- /Lesson10/problem_85/cppchallenger85.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson10/problem_85/cppchallenger85.db -------------------------------------------------------------------------------- /Lesson10/problem_86/cppchallenger86.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson10/problem_86/cppchallenger86.db -------------------------------------------------------------------------------- /Lesson10/problem_87/cppchallenger87.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson10/problem_87/cppchallenger87.db -------------------------------------------------------------------------------- /Lesson10/problem_87/res/the_matrix.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson10/problem_87/res/the_matrix.jpg -------------------------------------------------------------------------------- /Lesson10/problem_87/moviesdb.sql: -------------------------------------------------------------------------------- 1 | create table media( 2 | movieid integer not null, 3 | name text not null, 4 | description text, 5 | content blob not null); -------------------------------------------------------------------------------- /Lesson10/problem_87/res/forrest_gump.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson10/problem_87/res/forrest_gump.jpg -------------------------------------------------------------------------------- /Lesson12/problem_9a/res/albert_and_elsa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TrainingByPackt/The-Modern-Cpp-Challenger-eLearning/HEAD/Lesson12/problem_9a/res/albert_and_elsa.jpg -------------------------------------------------------------------------------- /Lesson01/problem_01/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_01) 3 | 4 | add_executable(problem_01 main.cpp) 5 | 6 | set_target_properties (problem_01 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_02/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_02) 3 | 4 | add_executable(problem_02 main.cpp) 5 | 6 | set_target_properties (problem_02 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_03/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_03) 3 | 4 | add_executable(problem_03 main.cpp) 5 | 6 | set_target_properties (problem_03 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_04/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_04) 3 | 4 | add_executable(problem_04 main.cpp) 5 | 6 | set_target_properties (problem_04 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_05/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_05) 3 | 4 | add_executable(problem_05 main.cpp) 5 | 6 | set_target_properties (problem_05 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_06/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_06) 3 | 4 | add_executable(problem_06 main.cpp) 5 | 6 | set_target_properties (problem_06 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_07/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_07) 3 | 4 | add_executable(problem_07 main.cpp) 5 | 6 | set_target_properties (problem_07 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_08/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_08) 3 | 4 | add_executable(problem_08 main.cpp) 5 | 6 | set_target_properties (problem_08 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_09/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_08) 3 | 4 | add_executable(problem_09 main.cpp) 5 | 6 | set_target_properties (problem_09 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_10/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_10) 3 | 4 | add_executable(problem_10 main.cpp) 5 | 6 | set_target_properties (problem_10 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_11) 3 | 4 | add_executable(problem_11 main.cpp) 5 | 6 | set_target_properties (problem_11 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_12/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_12) 3 | 4 | add_executable(problem_12 main.cpp) 5 | 6 | set_target_properties (problem_12 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_13/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_13) 3 | 4 | add_executable(problem_13 main.cpp) 5 | 6 | set_target_properties (problem_13 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson01/problem_14/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_14) 3 | 4 | add_executable(problem_14 main.cpp) 5 | 6 | set_target_properties (problem_14 PROPERTIES FOLDER "01.Math") -------------------------------------------------------------------------------- /Lesson02/problem_15/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_15) 3 | 4 | add_executable(problem_15 main.cpp) 5 | 6 | set_target_properties (problem_15 PROPERTIES FOLDER "02.Language") -------------------------------------------------------------------------------- /Lesson02/problem_16/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_16) 3 | 4 | add_executable(problem_16 main.cpp) 5 | 6 | set_target_properties (problem_16 PROPERTIES FOLDER "02.Language") -------------------------------------------------------------------------------- /Lesson02/problem_17/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_17) 3 | 4 | add_executable(problem_17 main.cpp) 5 | 6 | set_target_properties (problem_17 PROPERTIES FOLDER "02.Language") -------------------------------------------------------------------------------- /Lesson02/problem_18/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_18) 3 | 4 | add_executable(problem_18 main.cpp) 5 | 6 | set_target_properties (problem_18 PROPERTIES FOLDER "02.Language") -------------------------------------------------------------------------------- /Lesson02/problem_19/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_19) 3 | 4 | add_executable(problem_19 main.cpp) 5 | 6 | set_target_properties (problem_19 PROPERTIES FOLDER "02.Language") -------------------------------------------------------------------------------- /Lesson02/problem_20/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_20) 3 | 4 | add_executable(problem_20 main.cpp) 5 | 6 | set_target_properties (problem_20 PROPERTIES FOLDER "02.Language") -------------------------------------------------------------------------------- /Lesson02/problem_21/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_21) 3 | 4 | add_executable(problem_21 main.cpp) 5 | 6 | set_target_properties (problem_21 PROPERTIES FOLDER "02.Language") -------------------------------------------------------------------------------- /Lesson02/problem_22/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_22) 3 | 4 | add_executable(problem_22 main.cpp) 5 | 6 | set_target_properties (problem_22 PROPERTIES FOLDER "02.Language") -------------------------------------------------------------------------------- /Lesson03/problem_23/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_23) 3 | 4 | add_executable(problem_23 main.cpp) 5 | 6 | set_target_properties (problem_23 PROPERTIES FOLDER "03.Strings") -------------------------------------------------------------------------------- /Lesson03/problem_24/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_24) 3 | 4 | add_executable(problem_24 main.cpp) 5 | 6 | set_target_properties (problem_24 PROPERTIES FOLDER "03.Strings") -------------------------------------------------------------------------------- /Lesson03/problem_25/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_25) 3 | 4 | add_executable(problem_25 main.cpp) 5 | 6 | set_target_properties (problem_25 PROPERTIES FOLDER "03.Strings") -------------------------------------------------------------------------------- /Lesson03/problem_26/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_26) 3 | 4 | add_executable(problem_26 main.cpp) 5 | 6 | set_target_properties (problem_26 PROPERTIES FOLDER "03.Strings") -------------------------------------------------------------------------------- /Lesson03/problem_27/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_27) 3 | 4 | add_executable(problem_27 main.cpp) 5 | 6 | set_target_properties (problem_27 PROPERTIES FOLDER "03.Strings") -------------------------------------------------------------------------------- /Lesson03/problem_28/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_28) 3 | 4 | add_executable(problem_28 main.cpp) 5 | 6 | set_target_properties (problem_28 PROPERTIES FOLDER "03.Strings") -------------------------------------------------------------------------------- /Lesson03/problem_29/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_29) 3 | 4 | add_executable(problem_29 main.cpp) 5 | 6 | set_target_properties (problem_29 PROPERTIES FOLDER "03.Strings") -------------------------------------------------------------------------------- /Lesson03/problem_31/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_31) 3 | 4 | add_executable(problem_31 main.cpp) 5 | 6 | set_target_properties (problem_31 PROPERTIES FOLDER "03.Strings") -------------------------------------------------------------------------------- /Lesson04/problem_32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_32) 3 | 4 | add_executable(problem_32 main.cpp) 5 | 6 | set_target_properties (problem_32 PROPERTIES FOLDER "04.Streams") -------------------------------------------------------------------------------- /Lesson05/problem_39/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_39) 3 | 4 | add_executable(problem_39 main.cpp) 5 | 6 | set_target_properties (problem_39 PROPERTIES FOLDER "05.Datetime") -------------------------------------------------------------------------------- /Lesson07/problem_61/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_61) 3 | 4 | add_executable(problem_61 main.cpp) 5 | 6 | set_target_properties (problem_61 PROPERTIES FOLDER "07.Concurrency") -------------------------------------------------------------------------------- /Lesson07/problem_62/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_62) 3 | 4 | add_executable(problem_62 main.cpp) 5 | 6 | set_target_properties (problem_62 PROPERTIES FOLDER "07.Concurrency") -------------------------------------------------------------------------------- /Lesson07/problem_63/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_63) 3 | 4 | add_executable(problem_63 main.cpp) 5 | 6 | set_target_properties (problem_63 PROPERTIES FOLDER "07.Concurrency") -------------------------------------------------------------------------------- /Lesson07/problem_64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_64) 3 | 4 | add_executable(problem_64 main.cpp) 5 | 6 | set_target_properties (problem_64 PROPERTIES FOLDER "07.Concurrency") -------------------------------------------------------------------------------- /Lesson07/problem_65/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_65) 3 | 4 | add_executable(problem_65 main.cpp) 5 | 6 | set_target_properties (problem_65 PROPERTIES FOLDER "07.Concurrency") -------------------------------------------------------------------------------- /Lesson07/problem_66/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_66) 3 | 4 | add_executable(problem_66 main.cpp) 5 | 6 | set_target_properties (problem_66 PROPERTIES FOLDER "07.Concurrency") -------------------------------------------------------------------------------- /Lesson11/problem_88/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_88) 3 | 4 | add_executable(problem_88 main.cpp) 5 | 6 | set_target_properties (problem_88 PROPERTIES FOLDER "11.Cryptography") -------------------------------------------------------------------------------- /Lesson11/problem_89/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_89) 3 | 4 | add_executable(problem_89 main.cpp) 5 | 6 | set_target_properties (problem_89 PROPERTIES FOLDER "11.Cryptography") -------------------------------------------------------------------------------- /Lesson11/problem_90/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_90) 3 | 4 | add_executable(problem_90 main.cpp) 5 | 6 | set_target_properties (problem_90 PROPERTIES FOLDER "11.Cryptography") -------------------------------------------------------------------------------- /Lesson08/problem_67/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_67) 3 | 4 | add_executable(problem_67 main.cpp) 5 | 6 | set_target_properties (problem_67 PROPERTIES FOLDER "08.DesignPatterns") -------------------------------------------------------------------------------- /Lesson08/problem_68/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_68) 3 | 4 | add_executable(problem_68 main.cpp) 5 | 6 | set_target_properties (problem_68 PROPERTIES FOLDER "08.DesignPatterns") -------------------------------------------------------------------------------- /Lesson08/problem_69/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_69) 3 | 4 | add_executable(problem_69 main.cpp) 5 | 6 | set_target_properties (problem_69 PROPERTIES FOLDER "08.DesignPatterns") -------------------------------------------------------------------------------- /Lesson08/problem_70/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_70) 3 | 4 | add_executable(problem_70 main.cpp) 5 | 6 | set_target_properties (problem_70 PROPERTIES FOLDER "08.DesignPatterns") -------------------------------------------------------------------------------- /Lesson08/problem_71/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_71) 3 | 4 | add_executable(problem_71 main.cpp) 5 | 6 | set_target_properties (problem_71 PROPERTIES FOLDER "08.DesignPatterns") -------------------------------------------------------------------------------- /Lesson08/problem_72/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_72) 3 | 4 | add_executable(problem_72 main.cpp) 5 | 6 | set_target_properties (problem_72 PROPERTIES FOLDER "08.DesignPatterns") -------------------------------------------------------------------------------- /Lesson04/problem_33/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_33) 3 | 4 | add_executable(problem_33 main.cpp) 5 | 6 | set_target_properties (problem_33 PROPERTIES FOLDER "04.Streams") -------------------------------------------------------------------------------- /Lesson06/problem_45/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_45) 3 | 4 | add_executable(problem_45 main.cpp) 5 | 6 | set_target_properties (problem_45 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_46/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_46) 3 | 4 | add_executable(problem_46 main.cpp) 5 | 6 | set_target_properties (problem_46 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_47/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_47) 3 | 4 | add_executable(problem_47 main.cpp) 5 | 6 | set_target_properties (problem_47 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_48/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_48) 3 | 4 | add_executable(problem_48 main.cpp) 5 | 6 | set_target_properties (problem_48 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_49/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_49) 3 | 4 | add_executable(problem_49 main.cpp) 5 | 6 | set_target_properties (problem_49 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_50/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_50) 3 | 4 | add_executable(problem_50 main.cpp) 5 | 6 | set_target_properties (problem_50 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_51/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_51) 3 | 4 | add_executable(problem_51 main.cpp) 5 | 6 | set_target_properties (problem_51 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_52/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_52) 3 | 4 | add_executable(problem_52 main.cpp) 5 | 6 | set_target_properties (problem_52 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_53/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_53) 3 | 4 | add_executable(problem_53 main.cpp) 5 | 6 | set_target_properties (problem_53 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_54/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_54) 3 | 4 | add_executable(problem_54 main.cpp) 5 | 6 | set_target_properties (problem_54 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_55/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_55) 3 | 4 | add_executable(problem_55 main.cpp) 5 | 6 | set_target_properties (problem_55 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_56/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_56) 3 | 4 | add_executable(problem_56 main.cpp) 5 | 6 | set_target_properties (problem_56 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_57/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_57) 3 | 4 | add_executable(problem_57 main.cpp) 5 | 6 | set_target_properties (problem_57 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_58/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_58) 3 | 4 | add_executable(problem_58 main.cpp) 5 | 6 | set_target_properties (problem_58 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_59/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_59) 3 | 4 | add_executable(problem_59 main.cpp) 5 | 6 | set_target_properties (problem_59 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson06/problem_60/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_60) 3 | 4 | add_executable(problem_60 main.cpp) 5 | 6 | set_target_properties (problem_60 PROPERTIES FOLDER "06.AlgorithmsDataStructures") -------------------------------------------------------------------------------- /Lesson05/problem_40/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_40) 3 | 4 | include_directories(${LIBS_PATH}/date/include/date) 5 | 6 | add_executable(problem_40 main.cpp) 7 | 8 | set_target_properties (problem_40 PROPERTIES FOLDER "05.Datetime") -------------------------------------------------------------------------------- /Lesson05/problem_41/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_41) 3 | 4 | include_directories(${LIBS_PATH}/date/include/date) 5 | 6 | add_executable(problem_41 main.cpp) 7 | 8 | set_target_properties (problem_41 PROPERTIES FOLDER "05.Datetime") -------------------------------------------------------------------------------- /Lesson05/problem_42/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_42) 3 | 4 | include_directories(${LIBS_PATH}/date/include/date) 5 | 6 | add_executable(problem_42 main.cpp) 7 | 8 | set_target_properties (problem_42 PROPERTIES FOLDER "05.Datetime") -------------------------------------------------------------------------------- /Lesson05/problem_44/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_44) 3 | 4 | include_directories(${LIBS_PATH}/date/include/date) 5 | 6 | add_executable(problem_44 main.cpp) 7 | 8 | set_target_properties (problem_44 PROPERTIES FOLDER "05.Datetime") -------------------------------------------------------------------------------- /Lesson09/problem_74/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_74) 3 | 4 | include_directories(${LIBS_PATH}/pugixml) 5 | 6 | add_executable(problem_74 ${LIBS_PATH}/pugixml/pugixml.cpp main.cpp) 7 | 8 | set_target_properties (problem_74 PROPERTIES FOLDER "09.DataSerialization") -------------------------------------------------------------------------------- /Lesson11/problem_91/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_91) 3 | 4 | include_directories(${LIBS_PATH}/cryptopp) 5 | add_definitions(-DCRYPTOPP_CXX11_LAMBDA) 6 | 7 | add_executable(problem_91 main.cpp) 8 | 9 | target_link_libraries(problem_91 cryptlib) 10 | 11 | set_target_properties (problem_91 PROPERTIES FOLDER "11.Cryptography") -------------------------------------------------------------------------------- /Lesson03/problem_30/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_30) 3 | 4 | if(BOOST_OPTIONAL) 5 | include_directories(${BOOST_INCLUDE_DIR}) 6 | link_directories(${BOOST_LIB_DIR}) 7 | add_definitions(-DUSE_BOOST_OPTIONAL) 8 | endif() 9 | 10 | add_executable(problem_30 main.cpp) 11 | 12 | set_target_properties (problem_30 PROPERTIES FOLDER "03.Strings") -------------------------------------------------------------------------------- /Lesson01/problem_01/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | unsigned int limit = 0; 6 | std::cout << "Upper limit:"; 7 | std::cin >> limit; 8 | 9 | unsigned long long sum = 0; 10 | for (unsigned int i = 3; i < limit; ++i) 11 | { 12 | if (i % 3 == 0 || i % 5 == 0) 13 | sum += i; 14 | } 15 | 16 | std::cout << "sum=" << sum << std::endl; 17 | } 18 | -------------------------------------------------------------------------------- /Lesson05/problem_43/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_43) 3 | 4 | add_definitions(-DINSTALL=${LIBS_PATH}/date) 5 | include_directories(${LIBS_PATH}/date/include/date) 6 | include_directories(${LIBS_PATH}/date/include) 7 | 8 | add_executable(problem_43 ${LIBS_PATH}/date/src/tz.cpp main.cpp) 9 | 10 | set_target_properties (problem_43 PROPERTIES FOLDER "05.Datetime") -------------------------------------------------------------------------------- /Lesson12/problem_95/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_95) 3 | 4 | if (UNIX) 5 | else() 6 | add_definitions(-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -D_WIN32_WINNT=0x0601) 7 | endif() 8 | 9 | include_directories(${LIBS_PATH}/asio/include) 10 | 11 | add_executable(problem_95 main.cpp) 12 | 13 | set_target_properties (problem_95 PROPERTIES FOLDER "12.NetworkingCloud") -------------------------------------------------------------------------------- /Lesson12/problem_96c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_96c) 3 | 4 | if (UNIX) 5 | else() 6 | add_definitions(-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -D_WIN32_WINNT=0x0601) 7 | endif() 8 | 9 | include_directories(${LIBS_PATH}/asio/include) 10 | 11 | add_executable(problem_96c main.cpp) 12 | 13 | set_target_properties (problem_96c PROPERTIES FOLDER "12.NetworkingCloud") -------------------------------------------------------------------------------- /Lesson12/problem_96s/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_96s) 3 | 4 | if (UNIX) 5 | else() 6 | add_definitions(-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -D_WIN32_WINNT=0x0601) 7 | endif() 8 | 9 | include_directories(${LIBS_PATH}/asio/include) 10 | 11 | add_executable(problem_96s main.cpp) 12 | 13 | set_target_properties (problem_96s PROPERTIES FOLDER "12.NetworkingCloud") -------------------------------------------------------------------------------- /Lesson09/problem_75/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_75) 3 | 4 | include_directories(${LIBS_PATH}/nlohmannjson) 5 | include_directories(${INCLUDE_PATH}/) 6 | 7 | if(BOOST_OPTIONAL) 8 | include_directories(${BOOST_INCLUDE_DIR}) 9 | link_directories(${BOOST_LIB_DIR}) 10 | add_definitions(-DUSE_BOOST_OPTIONAL) 11 | endif() 12 | 13 | add_executable(problem_75 main.cpp) 14 | 15 | set_target_properties (problem_75 PROPERTIES FOLDER "09.DataSerialization") -------------------------------------------------------------------------------- /Lesson09/problem_76/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_76) 3 | 4 | include_directories(${INCLUDE_PATH}/) 5 | include_directories(${LIBS_PATH}/nlohmannjson) 6 | 7 | if(BOOST_OPTIONAL) 8 | include_directories(${BOOST_INCLUDE_DIR}) 9 | link_directories(${BOOST_LIB_DIR}) 10 | add_definitions(-DUSE_BOOST_OPTIONAL) 11 | endif() 12 | 13 | add_executable(problem_76 main.cpp) 14 | 15 | set_target_properties (problem_76 PROPERTIES FOLDER "09.DataSerialization") -------------------------------------------------------------------------------- /Lesson03/problem_31/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | std::string transform_date(std::string_view text) 7 | { 8 | auto rx = std::regex{ R"((\d{1,2})(\.|-|/)(\d{1,2})(\.|-|/)(\d{4}))" }; 9 | return std::regex_replace(text.data(), rx, R"($5-$3-$1)"); 10 | } 11 | 12 | int main() 13 | { 14 | using namespace std::string_literals; 15 | 16 | assert( 17 | transform_date("today is 01.12.2017!"s) == 18 | "today is 2017-12-01!"s); 19 | } 20 | -------------------------------------------------------------------------------- /Lesson09/problem_73/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_70) 3 | 4 | include_directories(${LIBS_PATH}/pugixml) 5 | include_directories(${INCLUDE_PATH}/) 6 | 7 | if(BOOST_OPTIONAL) 8 | include_directories(${BOOST_INCLUDE_DIR}) 9 | link_directories(${BOOST_LIB_DIR}) 10 | add_definitions(-DUSE_BOOST_OPTIONAL) 11 | endif() 12 | 13 | add_executable(problem_73 ${LIBS_PATH}/pugixml/pugixml.cpp main.cpp) 14 | 15 | set_target_properties (problem_73 PROPERTIES FOLDER "09.DataSerialization") -------------------------------------------------------------------------------- /Lesson10/problem_82/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_82) 3 | 4 | include_directories(${LIBS_PATH}/PDF-Writer/LibPng) 5 | include_directories(${LIBS_PATH}/PDF-Writer/ZLib) 6 | include_directories(${LIBS_PATH}/PDF-Writer/FreeType/include) 7 | include_directories(${LIBS_PATH}/pngwriter) 8 | 9 | add_executable(problem_82 main.cpp) 10 | 11 | target_link_libraries(problem_82 LibPng) 12 | target_link_libraries(problem_82 Zlib) 13 | target_link_libraries(problem_82 FreeType) 14 | target_link_libraries(problem_82 PngWriter) 15 | 16 | set_target_properties (problem_82 PROPERTIES FOLDER "10.ArchivesImagesDatabases") -------------------------------------------------------------------------------- /Lesson10/problem_83/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_83) 3 | 4 | include_directories(${LIBS_PATH}/PDF-Writer/LibPng) 5 | include_directories(${LIBS_PATH}/PDF-Writer/ZLib) 6 | include_directories(${LIBS_PATH}/PDF-Writer/FreeType/include) 7 | include_directories(${LIBS_PATH}/pngwriter) 8 | 9 | add_executable(problem_83 main.cpp) 10 | 11 | target_link_libraries(problem_83 LibPng) 12 | target_link_libraries(problem_83 Zlib) 13 | target_link_libraries(problem_83 FreeType) 14 | target_link_libraries(problem_83 PngWriter) 15 | 16 | set_target_properties (problem_83 PROPERTIES FOLDER "10.ArchivesImagesDatabases") -------------------------------------------------------------------------------- /Lesson10/problem_84/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_84) 3 | 4 | include_directories(${LIBS_PATH}/PDF-Writer/LibPng) 5 | include_directories(${LIBS_PATH}/PDF-Writer/ZLib) 6 | include_directories(${LIBS_PATH}/PDF-Writer/FreeType/include) 7 | include_directories(${LIBS_PATH}/pngwriter) 8 | 9 | add_executable(problem_84 main.cpp) 10 | 11 | target_link_libraries(problem_84 LibPng) 12 | target_link_libraries(problem_84 Zlib) 13 | target_link_libraries(problem_84 FreeType) 14 | target_link_libraries(problem_84 PngWriter) 15 | 16 | set_target_properties (problem_84 PROPERTIES FOLDER "10.ArchivesImagesDatabases") -------------------------------------------------------------------------------- /Lesson02/problem_19/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | template 8 | void push_back(C& c, Args&&... args) 9 | { 10 | (c.push_back(args), ...); 11 | } 12 | 13 | int main() 14 | { 15 | std::vector v; 16 | push_back(v, 1, 2, 3, 4); 17 | std::copy(std::begin(v), std::end(v), 18 | std::ostream_iterator(std::cout, " ")); 19 | 20 | std::list l; 21 | push_back(l, 1, 2, 3, 4); 22 | std::copy(std::begin(l), std::end(l), 23 | std::ostream_iterator(std::cout, " ")); 24 | } 25 | -------------------------------------------------------------------------------- /Lesson12/problem_98/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_98) 3 | 4 | add_definitions(-DCURL_STATICLIB) 5 | 6 | include_directories(${LIBS_PATH}/curl/include) 7 | include_directories(${LIBS_PATH}/curlcpp/include) 8 | 9 | add_executable(problem_98 main.cpp) 10 | 11 | target_link_libraries(problem_98 libcurl) 12 | target_link_libraries(problem_98 curlcpp) 13 | 14 | if (UNIX) 15 | link_directories(${CURLCPP_LIB_LOCATION}) 16 | elseif(WIN32) 17 | target_link_libraries(problem_98 Crypt32.lib ws2_32.lib winmm.lib wldap32.lib) 18 | endif() 19 | 20 | set_target_properties (problem_98 PROPERTIES FOLDER "12.NetworkingCloud") -------------------------------------------------------------------------------- /Lesson12/problem_99/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_99) 3 | 4 | add_definitions(-DCURL_STATICLIB) 5 | 6 | include_directories(${LIBS_PATH}/curl/include) 7 | include_directories(${LIBS_PATH}/curlcpp/include) 8 | 9 | add_executable(problem_99 main.cpp) 10 | 11 | target_link_libraries(problem_99 libcurl) 12 | target_link_libraries(problem_99 curlcpp) 13 | 14 | if (UNIX) 15 | link_directories(${CURLCPP_LIB_LOCATION}) 16 | elseif(WIN32) 17 | target_link_libraries(problem_99 Crypt32.lib ws2_32.lib winmm.lib wldap32.lib) 18 | endif() 19 | 20 | set_target_properties (problem_99 PROPERTIES FOLDER "12.NetworkingCloud") -------------------------------------------------------------------------------- /Lesson12/problem_97/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_97) 3 | 4 | add_definitions(-DCURL_STATICLIB) 5 | 6 | include_directories(${LIBS_PATH}/nlohmannjson) 7 | include_directories(${LIBS_PATH}/curl/include) 8 | include_directories(${LIBS_PATH}/curlcpp/include) 9 | 10 | add_executable(problem_97 main.cpp) 11 | 12 | target_link_libraries(problem_97 libcurl) 13 | target_link_libraries(problem_97 curlcpp) 14 | 15 | if (UNIX) 16 | link_directories(${CURLCPP_LIB_LOCATION}) 17 | elseif(WIN32) 18 | target_link_libraries(problem_97 Crypt32.lib ws2_32.lib winmm.lib wldap32.lib) 19 | endif() 20 | 21 | set_target_properties (problem_97 PROPERTIES FOLDER "12.NetworkingCloud") -------------------------------------------------------------------------------- /Lesson01/problem_02/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned int gcd(unsigned int const a, unsigned int const b) 4 | { 5 | return b == 0 ? a : gcd(b, a % b); 6 | } 7 | 8 | unsigned int gcd2(unsigned int a, unsigned int b) 9 | { 10 | while (b != 0) 11 | { 12 | unsigned int r = a % b; 13 | a = b; 14 | b = r; 15 | } 16 | 17 | return a; 18 | } 19 | 20 | int main() 21 | { 22 | std::cout << "Input numbers:"; 23 | 24 | unsigned int a, b; 25 | std::cin >> a >> b; 26 | 27 | std::cout 28 | << "rec gcd(" << a << ", " << b << ")=" 29 | << gcd(a, b) << std::endl; 30 | 31 | std::cout 32 | << " gcd(" << a << ", " << b << ")=" 33 | << gcd2(a, b) << std::endl; 34 | } 35 | -------------------------------------------------------------------------------- /Lesson04/problem_35/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_35) 3 | 4 | if(BOOST_FILESYSTEM) 5 | include_directories(${BOOST_INCLUDE_DIR}) 6 | link_directories(${BOOST_LIB_DIR}) 7 | add_definitions(-DUSE_BOOST_FILESYSTEM) 8 | else() 9 | if(MSVC) 10 | add_definitions(-DFILESYSTEM_EXPERIMENTAL) 11 | endif() 12 | endif() 13 | 14 | add_executable(problem_35 main.cpp) 15 | 16 | if(BOOST_FILESYSTEM) 17 | if(UNIX) 18 | find_package(Boost COMPONENTS system filesystem REQUIRED) 19 | 20 | target_link_libraries(problem_35 ${Boost_FILESYSTEM_LIBRARY} 21 | ${Boost_SYSTEM_LIBRARY}) 22 | endif() 23 | endif() 24 | 25 | set_target_properties (problem_35 PROPERTIES FOLDER "04.Streams") -------------------------------------------------------------------------------- /Lesson04/problem_36/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_36) 3 | 4 | if(BOOST_FILESYSTEM) 5 | include_directories(${BOOST_INCLUDE_DIR}) 6 | link_directories(${BOOST_LIB_DIR}) 7 | add_definitions(-DUSE_BOOST_FILESYSTEM) 8 | else() 9 | if(MSVC) 10 | add_definitions(-DFILESYSTEM_EXPERIMENTAL) 11 | endif() 12 | endif() 13 | 14 | add_executable(problem_36 main.cpp) 15 | 16 | if(BOOST_FILESYSTEM) 17 | if(UNIX) 18 | find_package(Boost COMPONENTS system filesystem REQUIRED) 19 | 20 | target_link_libraries(problem_36 ${Boost_FILESYSTEM_LIBRARY} 21 | ${Boost_SYSTEM_LIBRARY}) 22 | endif() 23 | endif() 24 | 25 | set_target_properties (problem_36 PROPERTIES FOLDER "04.Streams") -------------------------------------------------------------------------------- /Lesson04/problem_37/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_37) 3 | 4 | if(BOOST_FILESYSTEM) 5 | include_directories(${BOOST_INCLUDE_DIR}) 6 | link_directories(${BOOST_LIB_DIR}) 7 | add_definitions(-DUSE_BOOST_FILESYSTEM) 8 | else() 9 | if(MSVC) 10 | add_definitions(-DFILESYSTEM_EXPERIMENTAL) 11 | endif() 12 | endif() 13 | 14 | add_executable(problem_37 main.cpp) 15 | 16 | if(BOOST_FILESYSTEM) 17 | if(UNIX) 18 | find_package(Boost COMPONENTS system filesystem REQUIRED) 19 | 20 | target_link_libraries(problem_37 ${Boost_FILESYSTEM_LIBRARY} 21 | ${Boost_SYSTEM_LIBRARY}) 22 | endif() 23 | endif() 24 | 25 | set_target_properties (problem_37 PROPERTIES FOLDER "04.Streams") -------------------------------------------------------------------------------- /Lesson05/problem_41/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "date.h" 4 | #include "iso_week.h" 5 | 6 | unsigned int week_day(int const y, unsigned int const m, unsigned int const d) 7 | { 8 | using namespace date; 9 | 10 | if(m < 1 || m > 12 || d < 1 || d > 31) return 0; 11 | 12 | auto const dt = date::year_month_day{ year{ y }, month{ m }, day{ d } }; 13 | auto const tiso = iso_week::year_weeknum_weekday{ dt }; 14 | 15 | return (unsigned int)tiso.weekday(); 16 | } 17 | 18 | int main() 19 | { 20 | int y = 0; 21 | unsigned int m = 0, d = 0; 22 | std::cout << "Year:"; std::cin >> y; 23 | std::cout << "Month:"; std::cin >> m; 24 | std::cout << "Day:"; std::cin >> d; 25 | 26 | std::cout << "Day of week:" << week_day(y, m, d) << std::endl; 27 | } 28 | -------------------------------------------------------------------------------- /Lesson01/problem_05/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | bool is_prime(int const num) 4 | { 5 | if (num <= 3) 6 | { 7 | return num > 1; 8 | } 9 | else if (num % 2 == 0 || num % 3 == 0) 10 | { 11 | return false; 12 | } 13 | else 14 | { 15 | for (int i = 5; i * i <= num; i += 6) 16 | { 17 | if (num % i == 0 || num % (i + 2) == 0) 18 | { 19 | return false; 20 | } 21 | } 22 | 23 | return true; 24 | } 25 | } 26 | 27 | int main() 28 | { 29 | int limit = 0; 30 | std::cout << "Upper limit:"; 31 | std::cin >> limit; 32 | 33 | for (int n = 2; n <= limit; n++) 34 | { 35 | if (is_prime(n) && is_prime(n + 6)) 36 | { 37 | std::cout << n << "," << n + 6 << std::endl; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Lesson02/problem_18/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | T minimum(T const a, T const b) { return a < b ? a : b; } 6 | 7 | template 8 | T1 minimum(T1 a, T... args) 9 | { 10 | return minimum(a, minimum(args...)); 11 | } 12 | 13 | template 14 | T minimumc(Compare comp, T const a, T const b) { return comp(a, b) ? a : b; } 15 | 16 | template 17 | T1 minimumc(Compare comp, T1 a, T... args) 18 | { 19 | return minimumc(comp, a, minimumc(comp, args...)); 20 | } 21 | 22 | int main() 23 | { 24 | auto x = minimum(5, 4, 2, 3); 25 | std::cout << x << std::endl; 26 | 27 | auto y = minimumc(std::less<>(), 3, 2, 1, 0); 28 | std::cout << y << std::endl; 29 | } 30 | -------------------------------------------------------------------------------- /Lesson01/problem_04/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | bool is_prime(int const num) 4 | { 5 | if (num <= 3) 6 | { 7 | return num > 1; 8 | } 9 | else if (num % 2 == 0 || num % 3 == 0) 10 | { 11 | return false; 12 | } 13 | else 14 | { 15 | for (int i = 5; i * i <= num; i += 6) 16 | { 17 | if (num % i == 0 || num % (i + 2) == 0) 18 | { 19 | return false; 20 | } 21 | } 22 | 23 | return true; 24 | } 25 | } 26 | 27 | int main() 28 | { 29 | int limit = 0; 30 | std::cout << "Upper limit:"; 31 | std::cin >> limit; 32 | 33 | for (int i = limit; i > 1; i--) 34 | { 35 | if (is_prime(i)) 36 | { 37 | std::cout << "Largest prime:" << i << std::endl; 38 | return 0; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Lesson04/problem_38/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_38) 3 | 4 | include_directories(${LIBS_PATH}/stduuid) 5 | 6 | if(BOOST_FILESYSTEM) 7 | include_directories(${BOOST_INCLUDE_DIR}) 8 | link_directories(${BOOST_LIB_DIR}) 9 | add_definitions(-DUSE_BOOST_FILESYSTEM) 10 | else() 11 | if(MSVC) 12 | add_definitions(-DFILESYSTEM_EXPERIMENTAL) 13 | endif() 14 | endif() 15 | 16 | add_executable(problem_38 main.cpp) 17 | 18 | if(BOOST_FILESYSTEM) 19 | if(UNIX) 20 | find_package(Boost COMPONENTS system filesystem REQUIRED) 21 | 22 | target_link_libraries(problem_38 ${Boost_FILESYSTEM_LIBRARY} 23 | ${Boost_SYSTEM_LIBRARY}) 24 | endif() 25 | endif() 26 | 27 | set_target_properties (problem_38 PROPERTIES FOLDER "04.Streams") -------------------------------------------------------------------------------- /Lesson01/problem_03/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int gcd(int const a, int const b) 6 | { 7 | return b == 0 ? a : gcd(b, a % b); 8 | } 9 | 10 | int lcm(int const a, int const b) 11 | { 12 | int h = gcd(a, b); 13 | return h ? (a * (b / h)) : 0; 14 | } 15 | 16 | template 17 | int lcmr(InputIt first, InputIt last) 18 | { 19 | return std::accumulate(first, last, 1, lcm); 20 | } 21 | 22 | int main() 23 | { 24 | int n = 0; 25 | std::cout << "Input count:"; 26 | std::cin >> n; 27 | 28 | std::vector numbers; 29 | for (int i = 0; i < n; ++i) 30 | { 31 | int v{ 0 }; 32 | std::cin >> v; 33 | numbers.push_back(v); 34 | } 35 | 36 | std::cout 37 | << "lcm=" 38 | << lcmr(std::begin(numbers), std::end(numbers)) 39 | << std::endl; 40 | } 41 | -------------------------------------------------------------------------------- /Lesson01/problem_06/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int sum_proper_divisors(int const number) 5 | { 6 | int result = 1; 7 | for (int i = 2; i <= std::sqrt(number); i++) 8 | { 9 | if (number%i == 0) 10 | { 11 | result += (i == (number / i)) ? i : (i + number / i); 12 | } 13 | } 14 | 15 | return result; 16 | } 17 | 18 | void print_abundant(int const limit) 19 | { 20 | for (int number = 10; number <= limit; ++number) 21 | { 22 | auto sum = sum_proper_divisors(number); 23 | if (sum > number) 24 | { 25 | std::cout 26 | << number 27 | << ", abundance=" << sum - number << std::endl; 28 | } 29 | } 30 | } 31 | 32 | int main() 33 | { 34 | int limit = 0; 35 | std::cout << "Upper limit:"; 36 | std::cin >> limit; 37 | 38 | print_abundant(limit); 39 | } 40 | -------------------------------------------------------------------------------- /Lesson10/problem_80/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_80) 3 | 4 | include_directories(${LIBS_PATH}/ZipLib) 5 | 6 | if(BOOST_FILESYSTEM) 7 | include_directories(${BOOST_INCLUDE_DIR}) 8 | link_directories(${BOOST_LIB_DIR}) 9 | add_definitions(-DUSE_BOOST_FILESYSTEM) 10 | else() 11 | if(MSVC) 12 | add_definitions(-DFILESYSTEM_EXPERIMENTAL) 13 | endif() 14 | endif() 15 | 16 | add_executable(problem_80 main.cpp) 17 | 18 | if(BOOST_FILESYSTEM) 19 | if(UNIX) 20 | find_package(Boost COMPONENTS system filesystem REQUIRED) 21 | 22 | target_link_libraries(problem_80 ${Boost_FILESYSTEM_LIBRARY} 23 | ${Boost_SYSTEM_LIBRARY}) 24 | endif() 25 | endif() 26 | 27 | target_link_libraries(problem_80 ZipLib) 28 | 29 | set_target_properties (problem_80 PROPERTIES FOLDER "10.ArchivesImagesDatabases") -------------------------------------------------------------------------------- /Lesson10/problem_81/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_81) 3 | 4 | include_directories(${LIBS_PATH}/ZipLib) 5 | 6 | if(BOOST_FILESYSTEM) 7 | include_directories(${BOOST_INCLUDE_DIR}) 8 | link_directories(${BOOST_LIB_DIR}) 9 | add_definitions(-DUSE_BOOST_FILESYSTEM) 10 | else() 11 | if(MSVC) 12 | add_definitions(-DFILESYSTEM_EXPERIMENTAL) 13 | endif() 14 | endif() 15 | 16 | add_executable(problem_81 main.cpp) 17 | 18 | if(BOOST_FILESYSTEM) 19 | if(UNIX) 20 | find_package(Boost COMPONENTS system filesystem REQUIRED) 21 | 22 | target_link_libraries(problem_81 ${Boost_FILESYSTEM_LIBRARY} 23 | ${Boost_SYSTEM_LIBRARY}) 24 | endif() 25 | endif() 26 | 27 | target_link_libraries(problem_81 ZipLib) 28 | 29 | set_target_properties (problem_81 PROPERTIES FOLDER "10.ArchivesImagesDatabases") -------------------------------------------------------------------------------- /Lesson06/problem_54/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | void pairwise(Input begin, Input end, Output result) 6 | { 7 | auto it = begin; 8 | while (it != end) 9 | { 10 | auto v1 = *it++; if (it == end) break; 11 | auto v2 = *it++; 12 | result++ = std::make_pair(v1, v2); 13 | } 14 | } 15 | 16 | template 17 | std::vector> pairwise(std::vector const & range) 18 | { 19 | std::vector> result; 20 | pairwise(std::begin(range), std::end(range), 21 | std::back_inserter(result)); 22 | 23 | return result; 24 | } 25 | 26 | int main() 27 | { 28 | std::vector v{ 1, 1, 3, 5, 8, 13, 21 }; 29 | 30 | auto result = pairwise(v); 31 | 32 | for (auto const & p : result) 33 | { 34 | std::cout << '{' << p.first << ',' << p.second << '}' << std::endl; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Lesson09/problem_77/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_77) 3 | 4 | include_directories(${LIBS_PATH}/PDF-Writer) 5 | include_directories(${LIBS_PATH}/PDF-Writer/FreeType/include) 6 | include_directories(${INCLUDE_PATH}) 7 | 8 | if(BOOST_OPTIONAL) 9 | include_directories(${BOOST_INCLUDE_DIR}) 10 | link_directories(${BOOST_LIB_DIR}) 11 | add_definitions(-DUSE_BOOST_OPTIONAL) 12 | endif() 13 | 14 | add_executable(problem_77 main.cpp) 15 | 16 | target_link_libraries(problem_77 ZipLib) 17 | target_link_libraries(problem_77 PDFWriter) 18 | target_link_libraries(problem_77 FreeType) 19 | target_link_libraries(problem_77 LibAesgm) 20 | target_link_libraries(problem_77 LibJpeg) 21 | target_link_libraries(problem_77 LibPng) 22 | target_link_libraries(problem_77 LibTiff) 23 | target_link_libraries(problem_77 Zlib) 24 | 25 | set_target_properties (problem_77 PROPERTIES FOLDER "09.DataSerialization") -------------------------------------------------------------------------------- /Lesson11/problem_92/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_92) 3 | 4 | include_directories(${LIBS_PATH}/cryptopp) 5 | 6 | if(BOOST_FILESYSTEM) 7 | include_directories(${BOOST_INCLUDE_DIR}) 8 | link_directories(${BOOST_LIB_DIR}) 9 | add_definitions(-DUSE_BOOST_FILESYSTEM) 10 | else() 11 | if(MSVC) 12 | add_definitions(-DFILESYSTEM_EXPERIMENTAL) 13 | endif() 14 | endif() 15 | 16 | add_definitions(-DCRYPTOPP_CXX11_LAMBDA) 17 | 18 | add_executable(problem_92 main.cpp) 19 | 20 | if(BOOST_FILESYSTEM) 21 | if(UNIX) 22 | find_package(Boost COMPONENTS system filesystem REQUIRED) 23 | 24 | target_link_libraries(problem_92 ${Boost_FILESYSTEM_LIBRARY} 25 | ${Boost_SYSTEM_LIBRARY}) 26 | endif() 27 | endif() 28 | 29 | target_link_libraries(problem_92 cryptlib) 30 | 31 | set_target_properties (problem_92 PROPERTIES FOLDER "11.Cryptography") -------------------------------------------------------------------------------- /Lesson04/problem_32/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | unsigned int number_of_digits(unsigned int const i) 6 | { 7 | return i > 0 ? (int)log10((double)i) + 1 : 1; 8 | } 9 | 10 | void print_pascal_triangle(int const n) 11 | { 12 | for (int i = 0; i < n; i++) 13 | { 14 | auto x = 1; 15 | std::cout << std::string((n - i - 1)*(n / 2), ' '); 16 | for (int j = 0; j <= i; j++) 17 | { 18 | auto y = x; 19 | x = x * (i - j) / (j + 1); 20 | auto maxlen = number_of_digits(x) - 1; 21 | std::cout << y << std::string(n - 1 - maxlen - n%2, ' '); 22 | } 23 | std::cout << std::endl; 24 | } 25 | } 26 | 27 | int main() 28 | { 29 | int n = 0; 30 | std::cout << "Levels (up to 10): "; 31 | std::cin >> n; 32 | if (n > 10) 33 | std::cout << "Value too large" << std::endl; 34 | else 35 | print_pascal_triangle(n); 36 | } 37 | -------------------------------------------------------------------------------- /Lesson01/problem_14/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | bool validate_isbn_10(std::string_view isbn) 9 | { 10 | auto valid = false; 11 | 12 | if (isbn.size() == 10 && 13 | std::count_if(std::begin(isbn), std::end(isbn), isdigit) == 10) 14 | { 15 | auto w = 10; 16 | auto sum = std::accumulate( 17 | std::begin(isbn), std::end(isbn), 0, 18 | [&w](int const total, char const c) { 19 | return total + w-- * (c - '0'); }); 20 | 21 | valid = !(sum % 11); 22 | } 23 | 24 | return valid; 25 | } 26 | 27 | int main() 28 | { 29 | assert(validate_isbn_10("0306406152")); 30 | assert(!validate_isbn_10("0306406151")); 31 | 32 | std::string isbn; 33 | std::cout << "isbn:"; 34 | std::cin >> isbn; 35 | 36 | std::cout << "valid: " << validate_isbn_10(isbn) << std::endl; 37 | } 38 | -------------------------------------------------------------------------------- /Lesson10/problem_82/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "pngwriter.h" 6 | 7 | void create_flag(int const width, int const height, std::string_view filepath) 8 | { 9 | pngwriter flag{ width, height, 0, filepath.data() }; 10 | 11 | int const size = width / 3; 12 | // red rectangle 13 | flag.filledsquare(0, 0, size, 2 * size, 65535, 0, 0); 14 | // yellow rectangle 15 | flag.filledsquare(size, 0, 2 * size, 2 * size, 65535, 65535, 0); 16 | // blue rectangle 17 | flag.filledsquare(2 * size, 0, 3 * size, 2 * size, 0, 0, 65535); 18 | 19 | flag.close(); 20 | } 21 | 22 | int main() 23 | { 24 | int width = 0, height = 0; 25 | std::string filepath; 26 | 27 | std::cout << "Width: "; 28 | std::cin >> width; 29 | 30 | std::cout << "Heigh: "; 31 | std::cin >> height; 32 | 33 | std::cout << "Output: "; 34 | std::cin >> filepath; 35 | 36 | create_flag(width, height, filepath); 37 | } 38 | -------------------------------------------------------------------------------- /Lesson12/problem_95/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define ASIO_STANDALONE 7 | #include "asio.hpp" 8 | 9 | std::vector get_ip_address(std::string_view hostname) 10 | { 11 | std::vector ips; 12 | 13 | try 14 | { 15 | asio::io_context context; 16 | asio::ip::tcp::resolver resolver(context); 17 | auto endpoints = resolver.resolve(asio::ip::tcp::v4(), hostname.data(), ""); 18 | 19 | for (auto e = endpoints.begin(); e != endpoints.end(); ++e) 20 | ips.push_back(((asio::ip::tcp::endpoint)*e).address().to_string()); 21 | } 22 | catch (std::exception const & e) 23 | { 24 | std::cerr << "exception: " << e.what() << std::endl; 25 | } 26 | 27 | return ips; 28 | } 29 | 30 | int main() 31 | { 32 | auto ips = get_ip_address("packtpub.com"); 33 | 34 | for (auto const & ip : ips) 35 | std::cout << ip << std::endl; 36 | } 37 | -------------------------------------------------------------------------------- /Lesson01/problem_10/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | unsigned int gray_encode(unsigned int const num) 6 | { 7 | return num ^ (num >> 1); 8 | } 9 | 10 | unsigned int gray_decode(unsigned int gray) 11 | { 12 | for (unsigned int bit = 1U << 31; bit > 1; bit >>= 1) 13 | { 14 | if (gray & bit) gray ^= bit >> 1; 15 | } 16 | return gray; 17 | } 18 | 19 | std::string to_binary(unsigned int value, int const digits) 20 | { 21 | return std::bitset<32>(value).to_string().substr(32-digits, digits); 22 | } 23 | 24 | int main() 25 | { 26 | std::cout << "Number\tBinary\tGray\tDecoded\n"; 27 | std::cout << "------\t------\t----\t-------\n"; 28 | 29 | for (unsigned int n = 0; n < 32; ++n) 30 | { 31 | auto encg = gray_encode(n); 32 | auto decg = gray_decode(encg); 33 | 34 | std::cout 35 | << n << "\t" << to_binary(n, 5) << "\t" 36 | << to_binary(encg, 5) << "\t" << decg << "\n"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Lesson10/problem_86/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_86) 3 | 4 | include_directories(${LIBS_PATH}/sqlite) 5 | include_directories(${LIBS_PATH}/sqlite_modern_cpp) 6 | include_directories(${INCLUDE_PATH}) 7 | 8 | if(BOOST_OPTIONAL) 9 | include_directories(${BOOST_INCLUDE_DIR}) 10 | link_directories(${BOOST_LIB_DIR}) 11 | add_definitions(-DUSE_BOOST_OPTIONAL) 12 | endif() 13 | 14 | add_executable(problem_86 ${LIBS_PATH}/sqlite/sqlite3.c main.cpp) 15 | 16 | add_custom_command(TARGET problem_86 PRE_BUILD 17 | COMMAND ${CMAKE_COMMAND} -E copy 18 | ${PROJECT_SOURCE_DIR}/cppchallenger86.db $) 19 | 20 | add_custom_command(TARGET problem_86 PRE_BUILD 21 | COMMAND ${CMAKE_COMMAND} -E copy 22 | ${PROJECT_SOURCE_DIR}/cppchallenger86.db ${CMAKE_CURRENT_BINARY_DIR}) 23 | 24 | set_target_properties (problem_86 PROPERTIES FOLDER "10.ArchivesImagesDatabases") -------------------------------------------------------------------------------- /Lesson03/problem_24/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | unsigned char hexchar_to_int(char const ch) 9 | { 10 | if (ch >= '0' && ch <= '9') return ch - '0'; 11 | if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10; 12 | if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10; 13 | throw std::invalid_argument("Invalid hexadecimal character"); 14 | } 15 | 16 | std::vector hexstr_to_bytes(std::string_view str) 17 | { 18 | std::vector result; 19 | 20 | for (size_t i = 0; i < str.size(); i += 2) 21 | { 22 | result.push_back( 23 | (hexchar_to_int(str[i]) << 4) | hexchar_to_int(str[i+1])); 24 | } 25 | 26 | return result; 27 | } 28 | 29 | int main() 30 | { 31 | std::vector expected{ 0xBA, 0xAD, 0xF0, 0x0D, 0x42 }; 32 | assert(hexstr_to_bytes("BAADF00D42") == expected); 33 | assert(hexstr_to_bytes("BaaDf00d42") == expected); 34 | } 35 | -------------------------------------------------------------------------------- /Lesson01/problem_11/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | std::string to_roman(unsigned int value) 6 | { 7 | std::vector> roman 8 | { 9 | { 1000, "M" },{ 900, "CM" }, 10 | { 500, "D" },{ 400, "CD" }, 11 | { 100, "C" },{ 90, "XC" }, 12 | { 50, "L" },{ 40, "XL" }, 13 | { 10, "X" },{ 9, "IX" }, 14 | { 5, "V" },{ 4, "IV" }, 15 | { 1, "I" } 16 | }; 17 | 18 | std::string result; 19 | for (auto const & kvp : roman) 20 | { 21 | while (value >= kvp.first) 22 | { 23 | result += kvp.second; 24 | value -= kvp.first; 25 | } 26 | } 27 | 28 | return result; 29 | } 30 | 31 | int main() 32 | { 33 | for(int i = 1; i <= 100; ++i) 34 | { 35 | std::cout << i << "\t" << to_roman(i) << std::endl; 36 | } 37 | 38 | int number = 0; 39 | std::cout << "number:"; 40 | std::cin >> number; 41 | 42 | std::cout << to_roman(number) << std::endl; 43 | } 44 | -------------------------------------------------------------------------------- /Lesson10/problem_85/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_85) 3 | 4 | include_directories(${LIBS_PATH}/sqlite) 5 | include_directories(${LIBS_PATH}/sqlite_modern_cpp) 6 | include_directories(${INCLUDE_PATH}) 7 | 8 | if(BOOST_OPTIONAL) 9 | include_directories(${BOOST_INCLUDE_DIR}) 10 | link_directories(${BOOST_LIB_DIR}) 11 | add_definitions(-DUSE_BOOST_OPTIONAL) 12 | endif() 13 | 14 | add_executable(problem_85 ${LIBS_PATH}/sqlite/sqlite3.c main.cpp) 15 | 16 | add_custom_command(TARGET problem_85 PRE_BUILD 17 | COMMAND ${CMAKE_COMMAND} -E copy 18 | ${PROJECT_SOURCE_DIR}/cppchallenger85.db $) 19 | 20 | add_custom_command(TARGET problem_85 PRE_BUILD 21 | COMMAND ${CMAKE_COMMAND} -E copy 22 | ${PROJECT_SOURCE_DIR}/cppchallenger85.db ${CMAKE_CURRENT_BINARY_DIR}) 23 | 24 | set_target_properties (problem_85 PROPERTIES FOLDER "10.ArchivesImagesDatabases") -------------------------------------------------------------------------------- /Lesson06/problem_52/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void print_permutations(std::string str) 6 | { 7 | std::sort(std::begin(str), std::end(str)); 8 | 9 | do 10 | { 11 | std::cout << str << std::endl; 12 | } while (std::next_permutation(std::begin(str), std::end(str))); 13 | } 14 | 15 | void next_permutation(std::string str, std::string perm) 16 | { 17 | if (str.empty()) std::cout << perm << std::endl; 18 | else 19 | { 20 | for (size_t i = 0; i < str.size(); ++i) 21 | { 22 | next_permutation(str.substr(1), perm + str[0]); 23 | 24 | std::rotate(std::begin(str), std::begin(str) + 1, std::end(str)); 25 | } 26 | } 27 | } 28 | 29 | void print_permutations_recursive(std::string str) 30 | { 31 | next_permutation(str, ""); 32 | } 33 | 34 | int main() 35 | { 36 | std::cout << "non-recursive version" << std::endl; 37 | print_permutations("main"); 38 | 39 | std::cout << "recursive version" << std::endl; 40 | print_permutations_recursive("main"); 41 | } 42 | -------------------------------------------------------------------------------- /Lesson01/problem_13/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | template < 7 | typename E = std::mt19937, 8 | typename D = std::uniform_real_distribution<>> 9 | double compute_pi(E& engine, D& dist, 10 | int const samples = 1000000) 11 | { 12 | auto hit = 0; 13 | 14 | for (auto i = 0; i {}; 29 | std::generate(std::begin(seed_data), std::end(seed_data), std::ref(rd)); 30 | std::seed_seq seq(std::begin(seed_data), std::end(seed_data)); 31 | auto eng = std::mt19937{ seq }; 32 | auto dist = std::uniform_real_distribution<>{ 0, 1 }; 33 | 34 | for (auto j = 0; j < 10; j++) 35 | { 36 | std::cout << compute_pi(eng, dist) << std::endl; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Lesson11/problem_88/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | std::string caesar_encrypt(std::string_view text, int const shift) 7 | { 8 | std::string str; 9 | str.reserve(text.length()); 10 | for (auto const & c : text) 11 | { 12 | if (isalpha(c) && isupper(c)) 13 | str += 'A' + (c - 'A' + shift) % 26; 14 | else 15 | str += c; 16 | } 17 | 18 | return str; 19 | } 20 | 21 | std::string caesar_decrypt(std::string_view text, int const shift) 22 | { 23 | std::string str; 24 | str.reserve(text.length()); 25 | for (auto const & c : text) 26 | { 27 | if (isalpha(c) && isupper(c)) 28 | str += 'A' + (26 + c - 'A' - shift) % 26; 29 | else 30 | str += c; 31 | } 32 | 33 | return str; 34 | } 35 | 36 | int main() 37 | { 38 | auto text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 39 | for (int i = 1; i <= 26; ++i) 40 | { 41 | auto enc = caesar_encrypt(text, i); 42 | auto dec = caesar_decrypt(enc, i); 43 | assert(text == dec); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Lesson06/problem_48/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | template 7 | std::vector> find_most_frequent(std::vector const & range) 8 | { 9 | std::map counts; 10 | 11 | for (auto const & e : range) counts[e]++; 12 | 13 | auto maxelem = std::max_element( 14 | std::cbegin(counts), std::cend(counts), 15 | [](auto const & e1, auto const & e2) { 16 | return e1.second < e2.second; 17 | }); 18 | 19 | std::vector> result; 20 | 21 | std::copy_if( 22 | std::begin(counts), std::end(counts), 23 | std::back_inserter(result), 24 | [maxelem](auto const & kvp) { 25 | return kvp.second == maxelem->second; 26 | }); 27 | 28 | return result; 29 | } 30 | 31 | int main() 32 | { 33 | auto range = std::vector{1,1,3,5,8,13,3,5,8,8,5}; 34 | auto result = find_most_frequent(range); 35 | 36 | for (auto const & e : result) 37 | { 38 | std::cout << e.first << " : " << e.second << std::endl; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Lesson01/problem_09/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | std::vector prime_factors(unsigned long long n) 8 | { 9 | std::vector factors; 10 | // print the number of 2s that divide n 11 | while (n % 2 == 0) 12 | { 13 | factors.push_back(2); 14 | n = n / 2; 15 | } 16 | 17 | for (unsigned long long i = 3; i <= std::sqrt(n); i += 2) 18 | { 19 | // while i divides n, print i and divide n 20 | while (n%i == 0) 21 | { 22 | factors.push_back(i); 23 | n = n / i; 24 | } 25 | } 26 | 27 | // n is a prime number greater than 2 28 | if (n > 2) 29 | factors.push_back(n); 30 | 31 | return factors; 32 | } 33 | 34 | int main() 35 | { 36 | unsigned long long number = 0; 37 | std::cout << "number:"; 38 | std::cin >> number; 39 | 40 | auto factors = prime_factors(number); 41 | 42 | std::copy( 43 | std::begin(factors), std::end(factors), 44 | std::ostream_iterator(std::cout, " ")); 45 | } 46 | -------------------------------------------------------------------------------- /Lesson12/problem_9a/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.7.0) 2 | project(problem_9a) 3 | 4 | add_definitions(-DCURL_STATICLIB) 5 | 6 | include_directories(${LIBS_PATH}/nlohmannjson) 7 | include_directories(${LIBS_PATH}/curl/include) 8 | include_directories(${LIBS_PATH}/curlcpp/include) 9 | 10 | add_executable(problem_9a main.cpp) 11 | 12 | target_link_libraries(problem_9a libcurl) 13 | target_link_libraries(problem_9a curlcpp) 14 | 15 | if (UNIX) 16 | link_directories(${CURLCPP_LIB_LOCATION}) 17 | elseif(WIN32) 18 | target_link_libraries(problem_9a Crypt32.lib ws2_32.lib winmm.lib wldap32.lib) 19 | endif() 20 | 21 | add_custom_command(TARGET problem_9a PRE_BUILD 22 | COMMAND ${CMAKE_COMMAND} -E copy_directory 23 | ${PROJECT_SOURCE_DIR}/res $/res) 24 | 25 | add_custom_command(TARGET problem_9a PRE_BUILD 26 | COMMAND ${CMAKE_COMMAND} -E copy_directory 27 | ${PROJECT_SOURCE_DIR}/res ${CMAKE_CURRENT_BINARY_DIR}/res) 28 | 29 | set_target_properties (problem_9a PROPERTIES FOLDER "12.NetworkingCloud") -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Training By Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Lesson06/problem_56/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | template < 7 | typename T, typename A, typename F, 8 | typename R = typename std::decay::type&(typename std::vector::const_reference)>::type>::type> 9 | std::vector select(std::vector const & c, F&& f) 10 | { 11 | std::vector v; 12 | std::transform( 13 | std::cbegin(c), std::cend(c), 14 | std::back_inserter(v), 15 | std::forward(f)); 16 | 17 | return v; 18 | } 19 | 20 | struct book 21 | { 22 | int id; 23 | std::string title; 24 | std::string author; 25 | }; 26 | 27 | int main() 28 | { 29 | std::vector books{ 30 | {101, "The C++ Programming Language", "Bjarne Stroustrup"}, 31 | {203, "Effective Modern C++", "Scott Meyers"}, 32 | {404, "The Modern C++ Programming Cookbook", "Marius Bancila"}}; 33 | 34 | auto titles = select(books, [](book const & b) {return b.title; }); 35 | 36 | for (auto const & title : titles) 37 | { 38 | std::cout << title << std::endl; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Lesson06/problem_55/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | void zip( 6 | Input1 begin1, Input1 end1, 7 | Input2 begin2, Input2 end2, 8 | Output result) 9 | { 10 | auto it1 = begin1; 11 | auto it2 = begin2; 12 | while (it1 != end1 && it2 != end2) 13 | { 14 | result++ = std::make_pair(*it1++, *it2++); 15 | } 16 | } 17 | 18 | template 19 | std::vector> zip( 20 | std::vector const & range1, 21 | std::vector const & range2) 22 | { 23 | std::vector> result; 24 | 25 | zip( 26 | std::begin(range1), std::end(range1), 27 | std::begin(range2), std::end(range2), 28 | std::back_inserter(result)); 29 | 30 | return result; 31 | } 32 | 33 | int main() 34 | { 35 | std::vector v1{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; 36 | std::vector v2{ 1, 1, 3, 5, 8, 13, 21 }; 37 | 38 | auto result = zip(v1, v2); 39 | 40 | for (auto const & p : result) 41 | { 42 | std::cout << '{' << p.first << ',' << p.second << '}' << std::endl; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Lesson09/problem_74/movies.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Lesson05/problem_39/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | template 7 | struct perf_timer 8 | { 9 | template 10 | static Time duration(F&& f, Args... args) 11 | { 12 | auto start = Clock::now(); 13 | 14 | std::invoke(std::forward(f), std::forward(args)...); 15 | 16 | auto end = Clock::now(); 17 | 18 | return std::chrono::duration_cast