diff --git a/exercises-cpp/jimoh_yusuf/ex01_basics/CMakeLists.txt b/exercises-cpp/jimoh_yusuf/ex01_basics/CMakeLists.txt index fd173b7a..9767c815 100644 --- a/exercises-cpp/jimoh_yusuf/ex01_basics/CMakeLists.txt +++ b/exercises-cpp/jimoh_yusuf/ex01_basics/CMakeLists.txt @@ -7,22 +7,27 @@ cmake_minimum_required ( VERSION 2.8.5 ) project ( WordCounter ) # Find custom cmake modules -set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../CMake") +set ( CMAKE_MODULE_PATH "../../../CMake") # Common setup -include ( CommonSetup ) + ############################################################################### # Executable ############################################################################### set ( SRC_FILES - src/main.cpp + src/main.cpp # add any additional source files here ) set ( HDR_FILES + ../ex02_oo_basics/src/Rectangle.cpp + ../ex02_oo_basics/src/Rectangle.h + ../ex02_oo_basics/src/Circle.cpp + ../ex02_oo_basics/src/Circle.h + # add any additional header files here ) -add_executable ( WordCounter ${SRC_FILES} ${HDR_FILES} ) +add_executable ( WordCounter ${SRC_FILES} ${HDR_FILES}) diff --git a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-433e391d75207a7ab675.json b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-62d1a7d1ad487487bb18.json similarity index 98% rename from exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-433e391d75207a7ab675.json rename to exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-62d1a7d1ad487487bb18.json index 39257d9f..c3e7cb1d 100644 --- a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-433e391d75207a7ab675.json +++ b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-62d1a7d1ad487487bb18.json @@ -149,10 +149,6 @@ "isCMake" : true, "isExternal" : true, "path" : "C:/Program Files/JetBrains/CLion 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake" - }, - { - "isExternal" : true, - "path" : "C:/Users/gfl56326/Documents/newstarter/CMake/CommonSetup.cmake" } ], "kind" : "cmakeFiles", diff --git a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-f34bfee0fe0b58026b8f.json b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-96976ee99bf3927d8850.json similarity index 93% rename from exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-f34bfee0fe0b58026b8f.json rename to exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-96976ee99bf3927d8850.json index cfc89ee2..49940fdb 100644 --- a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-f34bfee0fe0b58026b8f.json +++ b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-96976ee99bf3927d8850.json @@ -39,7 +39,7 @@ { "directoryIndex" : 0, "id" : "WordCounter::@6890427a1f51a3e7e1df", - "jsonFile" : "target-WordCounter-Debug-034c12d909577b73f735.json", + "jsonFile" : "target-WordCounter-Debug-38d7e9c602ffcde1e43c.json", "name" : "WordCounter", "projectIndex" : 0 } diff --git a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/index-2024-05-29T12-28-03-0350.json b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/index-2024-05-29T14-15-11-0280.json similarity index 87% rename from exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/index-2024-05-29T12-28-03-0350.json rename to exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/index-2024-05-29T14-15-11-0280.json index 6edac8a6..17b97679 100644 --- a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/index-2024-05-29T12-28-03-0350.json +++ b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/index-2024-05-29T14-15-11-0280.json @@ -26,7 +26,7 @@ "objects" : [ { - "jsonFile" : "codemodel-v2-f34bfee0fe0b58026b8f.json", + "jsonFile" : "codemodel-v2-96976ee99bf3927d8850.json", "kind" : "codemodel", "version" : { @@ -44,7 +44,7 @@ } }, { - "jsonFile" : "cmakeFiles-v1-433e391d75207a7ab675.json", + "jsonFile" : "cmakeFiles-v1-62d1a7d1ad487487bb18.json", "kind" : "cmakeFiles", "version" : { @@ -76,7 +76,7 @@ }, "cmakeFiles-v1" : { - "jsonFile" : "cmakeFiles-v1-433e391d75207a7ab675.json", + "jsonFile" : "cmakeFiles-v1-62d1a7d1ad487487bb18.json", "kind" : "cmakeFiles", "version" : { @@ -86,7 +86,7 @@ }, "codemodel-v2" : { - "jsonFile" : "codemodel-v2-f34bfee0fe0b58026b8f.json", + "jsonFile" : "codemodel-v2-96976ee99bf3927d8850.json", "kind" : "codemodel", "version" : { diff --git a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/target-WordCounter-Debug-034c12d909577b73f735.json b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/target-WordCounter-Debug-38d7e9c602ffcde1e43c.json similarity index 51% rename from exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/target-WordCounter-Debug-034c12d909577b73f735.json rename to exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/target-WordCounter-Debug-38d7e9c602ffcde1e43c.json index aed2b1fb..44673706 100644 --- a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/target-WordCounter-Debug-034c12d909577b73f735.json +++ b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.cmake/api/v1/reply/target-WordCounter-Debug-38d7e9c602ffcde1e43c.json @@ -2,10 +2,10 @@ "artifacts" : [ { - "path" : "bin/WordCounter.exe" + "path" : "WordCounter.exe" }, { - "path" : "bin/WordCounter.pdb" + "path" : "WordCounter.pdb" } ], "backtrace" : 1, @@ -13,15 +13,11 @@ { "commands" : [ - "add_executable", - "add_compile_options", - "include", - "add_definitions" + "add_executable" ], "files" : [ - "CMakeLists.txt", - "C:/Users/gfl56326/Documents/newstarter/CMake/CommonSetup.cmake" + "CMakeLists.txt" ], "nodes" : [ @@ -31,30 +27,8 @@ { "command" : 0, "file" : 0, - "line" : 28, + "line" : 33, "parent" : 0 - }, - { - "command" : 2, - "file" : 0, - "line" : 13, - "parent" : 0 - }, - { - "file" : 1, - "parent" : 2 - }, - { - "command" : 1, - "file" : 1, - "line" : 23, - "parent" : 3 - }, - { - "command" : 3, - "file" : 1, - "line" : 27, - "parent" : 3 } ] }, @@ -64,44 +38,15 @@ "compileCommandFragments" : [ { - "fragment" : "-g -std=c++17 -fdiagnostics-color=always" - }, - { - "backtrace" : 4, - "fragment" : "-Wall" - }, - { - "backtrace" : 4, - "fragment" : "-Wextra" - }, - { - "backtrace" : 4, - "fragment" : "-pedantic" - }, - { - "backtrace" : 4, - "fragment" : "-Werror" - } - ], - "defines" : - [ - { - "backtrace" : 5, - "define" : "_USE_MATH_DEFINES" + "fragment" : "-g -fdiagnostics-color=always" } ], "language" : "CXX", - "languageStandard" : - { - "backtraces" : - [ - 1 - ], - "standard" : "17" - }, "sourceIndexes" : [ - 0 + 0, + 1, + 3 ] } ], @@ -138,7 +83,17 @@ "name" : "Source Files", "sourceIndexes" : [ - 0 + 0, + 1, + 3 + ] + }, + { + "name" : "Header Files", + "sourceIndexes" : + [ + 2, + 4 ] } ], @@ -149,6 +104,28 @@ "compileGroupIndex" : 0, "path" : "src/main.cpp", "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "C:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "C:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "C:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "C:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.h", + "sourceGroupIndex" : 1 } ], "type" : "EXECUTABLE" diff --git a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.ninja_deps b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.ninja_deps index 5a4a1875..e7a66122 100644 Binary files a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.ninja_deps and b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.ninja_deps differ diff --git a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.ninja_log b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.ninja_log index 57269536..9d935187 100644 --- a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.ninja_log +++ b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/.ninja_log @@ -1,9 +1,13 @@ # ninja log v5 -8 3051 7386888511334206 CMakeFiles/WordCounter.dir/src/main.cpp.obj 86154237dcb42254 +15 3081 7386932941009066 CMakeFiles/WordCounter.dir/src/main.cpp.obj 542f860eccc2fb0a +31 176 7386876562470803 CMakeFiles/WordCounter.dir/src/Triangle.cpp.obj 303ff5c4e45d54e5 19 626 7386876566971174 CMakeFiles/WordCounter.dir/src/Square.cpp.obj e0094a043ca25abe -3053 5238 7386888533299834 bin/WordCounter.exe 7d65be3730c2ab60 +12 2164 7386906975292033 bin/WordCounter.exe 7d65be3730c2ab60 66 391 7386796154549875 CMakeFiles/WordCounter.dir/src/ShapeSorter.cpp.obj 8076f12ae963f28 -31 176 7386876562470803 CMakeFiles/WordCounter.dir/src/Triangle.cpp.obj 303ff5c4e45d54e5 -7 514 7386887213038788 CMakeFiles/WordCounter.dir/C_/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/main.cpp.obj 7ee5aa959a31254b -4 440 7386888832483927 build.ninja 2f1fe48deb7834c8 +25 629 7386932916614281 CMakeFiles/WordCounter.dir/C_/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/main.cpp.obj 383e3fe3ff19198e +7 420 7386953111981927 build.ninja 2f1fe48deb7834c8 17 157 7386860660992988 CMakeFiles/WordCounter.dir/src/Squaree.cpp.obj ca12d5043527a49d +13 2182 7386935426254388 WordCounter.exe 22ec09b1b0baf071 +7 639 7386957144422552 CMakeFiles/WordCounter.dir/C_/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.cpp.obj ce1123a11a563de0 +18 807 7386957146118258 CMakeFiles/WordCounter.dir/C_/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.cpp.obj db4d5b735a3d35ab +808 3002 7386957167970018 WordCounter.exe b8f99df30967da9a diff --git a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/Testing/Temporary/LastTest.log b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/Testing/Temporary/LastTest.log index b41da3d5..e3e29e0e 100644 --- a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: May 29 13:29 GMT Summer Time +Start testing: May 29 15:34 GMT Summer Time ---------------------------------------------------------- -End testing: May 29 13:29 GMT Summer Time +End testing: May 29 15:34 GMT Summer Time diff --git a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/build.ninja b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/build.ninja index 56c5e2d8..1413e4fb 100644 --- a/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/build.ninja +++ b/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug/build.ninja @@ -50,27 +50,38 @@ cmake_ninja_workdir = C$:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimo build cmake_object_order_depends_target_WordCounter: phony || CMakeFiles/WordCounter.dir build CMakeFiles/WordCounter.dir/src/main.cpp.obj: CXX_COMPILER__WordCounter_unscanned_Debug C$:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex01_basics/src/main.cpp || cmake_object_order_depends_target_WordCounter - DEFINES = -D_USE_MATH_DEFINES DEP_FILE = CMakeFiles\WordCounter.dir\src\main.cpp.obj.d - FLAGS = -g -std=c++17 -fdiagnostics-color=always -Wall -Wextra -pedantic -Werror + FLAGS = -g -fdiagnostics-color=always OBJECT_DIR = CMakeFiles\WordCounter.dir OBJECT_FILE_DIR = CMakeFiles\WordCounter.dir\src +build CMakeFiles/WordCounter.dir/C_/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.cpp.obj: CXX_COMPILER__WordCounter_unscanned_Debug C$:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.cpp || cmake_object_order_depends_target_WordCounter + DEP_FILE = CMakeFiles\WordCounter.dir\C_\Users\gfl56326\Documents\newstarter\exercises-cpp\jimoh_yusuf\ex02_oo_basics\src\Rectangle.cpp.obj.d + FLAGS = -g -fdiagnostics-color=always + OBJECT_DIR = CMakeFiles\WordCounter.dir + OBJECT_FILE_DIR = CMakeFiles\WordCounter.dir\C_\Users\gfl56326\Documents\newstarter\exercises-cpp\jimoh_yusuf\ex02_oo_basics\src + +build CMakeFiles/WordCounter.dir/C_/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.cpp.obj: CXX_COMPILER__WordCounter_unscanned_Debug C$:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.cpp || cmake_object_order_depends_target_WordCounter + DEP_FILE = CMakeFiles\WordCounter.dir\C_\Users\gfl56326\Documents\newstarter\exercises-cpp\jimoh_yusuf\ex02_oo_basics\src\Circle.cpp.obj.d + FLAGS = -g -fdiagnostics-color=always + OBJECT_DIR = CMakeFiles\WordCounter.dir + OBJECT_FILE_DIR = CMakeFiles\WordCounter.dir\C_\Users\gfl56326\Documents\newstarter\exercises-cpp\jimoh_yusuf\ex02_oo_basics\src + # ============================================================================= # Link build statements for EXECUTABLE target WordCounter ############################################# -# Link the executable bin\WordCounter.exe +# Link the executable WordCounter.exe -build bin/WordCounter.exe: CXX_EXECUTABLE_LINKER__WordCounter_Debug CMakeFiles/WordCounter.dir/src/main.cpp.obj +build WordCounter.exe: CXX_EXECUTABLE_LINKER__WordCounter_Debug CMakeFiles/WordCounter.dir/src/main.cpp.obj CMakeFiles/WordCounter.dir/C_/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.cpp.obj CMakeFiles/WordCounter.dir/C_/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.cpp.obj FLAGS = -g LINK_LIBRARIES = -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 OBJECT_DIR = CMakeFiles\WordCounter.dir POST_BUILD = cd . PRE_LINK = cd . - TARGET_FILE = bin\WordCounter.exe + TARGET_FILE = WordCounter.exe TARGET_IMPLIB = libWordCounter.dll.a TARGET_PDB = WordCounter.exe.dbg @@ -100,9 +111,7 @@ build rebuild_cache: phony CMakeFiles/rebuild_cache.util # ============================================================================= # Target aliases. -build WordCounter: phony bin/WordCounter.exe - -build WordCounter.exe: phony bin/WordCounter.exe +build WordCounter: phony WordCounter.exe # ============================================================================= # Folder targets. @@ -112,7 +121,7 @@ build WordCounter.exe: phony bin/WordCounter.exe ############################################# # Folder: C:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex01_basics/cmake-build-debug -build all: phony bin/WordCounter.exe +build all: phony WordCounter.exe # ============================================================================= # Unknown Build Time Dependencies. @@ -126,14 +135,14 @@ build all: phony bin/WordCounter.exe ############################################# # Re-run CMake if any of its inputs changed. -build build.ninja: RERUN_CMAKE | C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeGenericSystem.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeInitializeConfigs.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeRCInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystemSpecificInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystemSpecificInitialize.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/CMakeCommonCompilerMacros.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-C.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-CXX.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-C-ABI.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-C.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-CXX-ABI.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-CXX.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-Initialize.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-windres.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/WindowsPaths.cmake C$:/Users/gfl56326/Documents/newstarter/CMake/CommonSetup.cmake C$:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex01_basics/CMakeLists.txt CMakeCache.txt CMakeFiles/3.28.1/CMakeCCompiler.cmake CMakeFiles/3.28.1/CMakeCXXCompiler.cmake CMakeFiles/3.28.1/CMakeRCCompiler.cmake CMakeFiles/3.28.1/CMakeSystem.cmake +build build.ninja: RERUN_CMAKE | C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeGenericSystem.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeInitializeConfigs.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeRCInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystemSpecificInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystemSpecificInitialize.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/CMakeCommonCompilerMacros.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-C.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-CXX.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-C-ABI.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-C.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-CXX-ABI.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-CXX.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-Initialize.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-windres.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/WindowsPaths.cmake C$:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex01_basics/CMakeLists.txt CMakeCache.txt CMakeFiles/3.28.1/CMakeCCompiler.cmake CMakeFiles/3.28.1/CMakeCXXCompiler.cmake CMakeFiles/3.28.1/CMakeRCCompiler.cmake CMakeFiles/3.28.1/CMakeSystem.cmake pool = console ############################################# # A missing CMake input file is not an error. -build C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeGenericSystem.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeInitializeConfigs.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeRCInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystemSpecificInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystemSpecificInitialize.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/CMakeCommonCompilerMacros.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-C.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-CXX.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-C-ABI.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-C.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-CXX-ABI.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-CXX.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-Initialize.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-windres.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/WindowsPaths.cmake C$:/Users/gfl56326/Documents/newstarter/CMake/CommonSetup.cmake C$:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex01_basics/CMakeLists.txt CMakeCache.txt CMakeFiles/3.28.1/CMakeCCompiler.cmake CMakeFiles/3.28.1/CMakeCXXCompiler.cmake CMakeFiles/3.28.1/CMakeRCCompiler.cmake CMakeFiles/3.28.1/CMakeSystem.cmake: phony +build C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeGenericSystem.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeInitializeConfigs.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeRCInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystemSpecificInformation.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystemSpecificInitialize.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/CMakeCommonCompilerMacros.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-C.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-CXX.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-C-ABI.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-C.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-CXX-ABI.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU-CXX.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-GNU.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-Initialize.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows-windres.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Windows.cmake C$:/Program$ Files/JetBrains/CLion$ 2024.1.1/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/WindowsPaths.cmake C$:/Users/gfl56326/Documents/newstarter/exercises-cpp/jimoh_yusuf/ex01_basics/CMakeLists.txt CMakeCache.txt CMakeFiles/3.28.1/CMakeCCompiler.cmake CMakeFiles/3.28.1/CMakeCXXCompiler.cmake CMakeFiles/3.28.1/CMakeRCCompiler.cmake CMakeFiles/3.28.1/CMakeSystem.cmake: phony ############################################# diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/CMakeLists.txt b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/CMakeLists.txt index e8a599cc..d65bb528 100644 --- a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/CMakeLists.txt +++ b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/CMakeLists.txt @@ -22,13 +22,13 @@ set ( SRC_FILES ) set ( HDR_FILES - ../ex02_oo_basics/ShapeSorter.cpp - ../ex02_oo_basics/ShapeSorter.h - ../ex02_oo_basics/Shape.h - ../ex02_oo_basics/Square.cpp - ../ex02_oo_basics/Square.h - ../ex02_oo_basics/Triangle.cpp - ../ex02_oo_basics/Triangle.h + src/ShapeSorter.cpp + src/ShapeSorter.h + src/Shape.h + src/Square.cpp + src/Square.h + src/Triangle.cpp + src/Triangle.h # add any additional header files here ) diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/ShapeSorter.cpp b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/ShapeSorter.cpp deleted file mode 100644 index d1facb6f..00000000 --- a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/ShapeSorter.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// -// Created by gfl56326 on 28/05/2024. -// - -#include "ShapeSorter.h" diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/ShapeSorter.h b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/ShapeSorter.h deleted file mode 100644 index 321bbe38..00000000 --- a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/ShapeSorter.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// Created by gfl56326 on 28/05/2024. -// - -#ifndef SHAPESORTER_H -#define SHAPESORTER_H - - - -class ShapeSorter { - -}; - - - -#endif //SHAPESORTER_H diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/Triangle.h b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/Triangle.h deleted file mode 100644 index 7bd6190a..00000000 --- a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/Triangle.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// Created by gfl56326 on 29/05/2024. -// - -#ifndef TRIANGLE_H -#define TRIANGLE_H - - - -class Triangle { - -}; - - - -#endif //TRIANGLE_H diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.cpp b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.cpp new file mode 100644 index 00000000..8bfc01e9 --- /dev/null +++ b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.cpp @@ -0,0 +1,30 @@ +// +// Created by gfl56326 on 29/05/2024. +// + +#include "Circle.h" + +Circle::Circle(double r) : radius(r) { + number_of_sides = 0; +} + +std::string Circle::getType() { + return "Circle"; +} + +double Circle::calculatePerimeter() { + double perimeter = 2 * M_PI * radius; + std::cout << "The perimeter of the circle is " << perimeter << std::endl; + return perimeter; +} + +double Circle::calculateArea() { + double area = M_PI * radius * radius; + std::cout << "The area of the circle is " << area << std::endl; + return area; +} + +int Circle::getNumberOfSides() { + return number_of_sides; +} + diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.h b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.h new file mode 100644 index 00000000..7da050e6 --- /dev/null +++ b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Circle.h @@ -0,0 +1,27 @@ +// +// Created by gfl56326 on 29/05/2024. +// + +#ifndef CIRCLE_H +#define CIRCLE_H + +#include "Shape.h" +#include +#include +#include + +class Circle : public Shape { +private: + double radius; + +public: + Circle(double radius); + + std::string getType() override; + double calculatePerimeter() override; + double calculateArea() override; + int getNumberOfSides() override; +}; + +#endif // CIRCLE_H + diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.cpp b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.cpp new file mode 100644 index 00000000..76738c84 --- /dev/null +++ b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.cpp @@ -0,0 +1,30 @@ +// +// Created by gfl56326 on 29/05/2024. +// + +#include "Rectangle.h" + +Rectangle::Rectangle(double s1, double s2) : side1(s1), side2(s2) { + number_of_sides = 4; +} + +std::string Rectangle::getType() { + return "Rectangle"; +} + +double Rectangle::calculatePerimeter() { + double perimeter = 2 * (side1 + side2); + std::cout << "The perimeter of the rectangle is " << perimeter << std::endl; + return perimeter; +} + +double Rectangle::calculateArea() { + double area = side1 * side2; + std::cout << "The area of the rectangle is " << area << std::endl; + return area; +} + +int Rectangle::getNumberOfSides() { + return number_of_sides; +} + diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.h b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.h new file mode 100644 index 00000000..f03eae60 --- /dev/null +++ b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Rectangle.h @@ -0,0 +1,25 @@ +// +// Created by gfl56326 on 29/05/2024. +// + +#ifndef RECTANGLE_H +#define RECTANGLE_H + +#include "Shape.h" +#include +#include + +class Rectangle : public Shape { +private: + double side1, side2; + +public: + Rectangle(double side1, double side2); + + std::string getType() override; + double calculatePerimeter() override; + double calculateArea() override; + int getNumberOfSides() override; +}; + +#endif // RECTANGLE_H diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/Shape.h b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Shape.h similarity index 100% rename from exercises-cpp/jimoh_yusuf/ex02_oo_basics/Shape.h rename to exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Shape.h diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/ShapeSorter.cpp b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/ShapeSorter.cpp new file mode 100644 index 00000000..6940dced --- /dev/null +++ b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/ShapeSorter.cpp @@ -0,0 +1,42 @@ +// +// Created by gfl56326 on 28/05/2024. +// + +#include "ShapeSorter.h" + +void ShapeSorter::printShapesByType(const std::vector& shapes, const std::string& type) { + for (const auto& shape : shapes) { + if (shape->getType() == type) { + std::cout << shape->getType() << " with area: " << shape->calculateArea() << " and perimeter: " << shape->calculatePerimeter() << std::endl; + } + } +} + +void ShapeSorter::printShapesBySides(const std::vector& shapes, int numberOfSides) { + for (const auto& shape : shapes) { + if (shape->getNumberOfSides() == numberOfSides) { + std::cout << shape->getType() << " with area: " << shape->calculateArea() << " and perimeter: " << shape->calculatePerimeter() << std::endl; + } + } +} + +void ShapeSorter::printShapesByAreaDescending(std::vector& shapes) { + std::sort(shapes.begin(), shapes.end(), [](Shape* a, Shape* b) { + return a->calculateArea() > b->calculateArea(); + }); + + for (const auto& shape : shapes) { + std::cout << shape->getType() << " with area: " << shape->calculateArea() << " and perimeter: " << shape->calculatePerimeter() << std::endl; + } +} + +void ShapeSorter::printShapesByPerimeterDescending(std::vector& shapes) { + std::sort(shapes.begin(), shapes.end(), [](Shape* a, Shape* b) { + return a->calculatePerimeter() > b->calculatePerimeter(); + }); + + for (const auto& shape : shapes) { + std::cout << shape->getType() << " with area: " << shape->calculateArea() << " and perimeter: " << shape->calculatePerimeter() << std::endl; + } +} + diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/ShapeSorter.h b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/ShapeSorter.h new file mode 100644 index 00000000..f9c9c975 --- /dev/null +++ b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/ShapeSorter.h @@ -0,0 +1,21 @@ +// +// Created by gfl56326 on 28/05/2024. +// + +#ifndef SHAPESORTER_H +#define SHAPESORTER_H + +#include "Shape.h" +#include +#include +#include + +class ShapeSorter { +public: + void printShapesByType(const std::vector& shapes, const std::string& type); + void printShapesBySides(const std::vector& shapes, int numberOfSides); + void printShapesByAreaDescending(std::vector& shapes); + void printShapesByPerimeterDescending(std::vector& shapes); +}; + +#endif // SHAPESORTER_H diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/Square.cpp b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Square.cpp similarity index 94% rename from exercises-cpp/jimoh_yusuf/ex02_oo_basics/Square.cpp rename to exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Square.cpp index f0a617bf..66bb6f7b 100644 --- a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/Square.cpp +++ b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Square.cpp @@ -18,7 +18,7 @@ double Square::calculatePerimeter() { return perimeter; } -double Square::calculateArea() { +double Square::calculateAreaa() { double area = side1 * side1; std::cout << "The area of the square is " << area << std::endl; return area; diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/Square.h b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Square.h similarity index 100% rename from exercises-cpp/jimoh_yusuf/ex02_oo_basics/Square.h rename to exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Square.h diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/Triangle.cpp b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Triangle.cpp similarity index 100% rename from exercises-cpp/jimoh_yusuf/ex02_oo_basics/Triangle.cpp rename to exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Triangle.cpp diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Triangle.h b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Triangle.h new file mode 100644 index 00000000..cab28640 --- /dev/null +++ b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/Triangle.h @@ -0,0 +1,19 @@ +// +// Created by gfl56326 on 29/05/2024. +// + +#ifndef TRIANGLE_H +#define TRIANGLE_H + +class Triangle : public Shape { +private: + double side1; +public: + Triangle(double side); + + std::string getType() override; + double calculateArea() override; + int getNumberOfSides() override; +}; + +#endif //TRIANGLE_H diff --git a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/main.cpp b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/main.cpp index 27cd3b40..f7e819b8 100644 --- a/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/main.cpp +++ b/exercises-cpp/jimoh_yusuf/ex02_oo_basics/src/main.cpp @@ -4,27 +4,37 @@ #include using namespace std; -int main(int, char **) -{ - std::cout << "kolala" << std::endl; - //Square square(6); - //unique_ptr square = make_unique(6.0); - //shared_ptr square2 = make_shared(7.0); - //square->calculateArea(); - //square.calculatePerimeter(); +#include "Square.h" +#include "Rectangle.h" +#include "Circle.h" +#include "Triangle.h" +#include "ShapeSorter.h" +#include - //std::vector> shapes; - //shapes.push_back(square2); - //shapes.push_back(square2); +int main() { + // Create shapes + Square square(5.0); + Rectangle rectangle(4.0, 6.0); + Circle circle(3.0); + Triangle triangle(4.0, 6.0); - //v.push_back(10); + std::vector shapes = {&square, &rectangle, &circle, &triangle}; - //vector> shapes2; + ShapeSorter sorter; - // Creating a variety of shapes - //shapes2.push_back(make_shared(7.0)); - // - //std::cout << "kolala" << shapes2[1]->getType() << endl; + // Print shapes by type + std::cout << "Shapes of type 'Square':" << std::endl; + sorter.printShapesByType(shapes, "Square"); + // Print shapes by number of sides + std::cout << "\nShapes with 4 sides:" << std::endl; + sorter.printShapesBySides(shapes, 4); + + // Print shapes by area descending + std::cout << "\nShapes sorted by area (descending):" << std::endl; + sorter.printShapesByAreaDescending(shapes); + + // Print shapes by perimeter descending + std::cout << "\nShapes sorted by perimeter (descending): } \ No newline at end of file