diff options
author | Markus Ferrell <markus.ferrell@kitware.com> | 2023-02-10 21:07:06 (GMT) |
---|---|---|
committer | Markus Ferrell <markus.ferrell@kitware.com> | 2023-02-23 14:42:10 (GMT) |
commit | 8ddf32196c6bca9c3a80414222327eebd5d51835 (patch) | |
tree | 40ad09ab3e93b4d1bbc642fc921f1ddb3737853b /Help/guide/tutorial/Step8/tutorial.cxx | |
parent | 78299083d24fc09c777292effb4fdb9d9ed1d7d3 (diff) | |
download | CMake-8ddf32196c6bca9c3a80414222327eebd5d51835.zip CMake-8ddf32196c6bca9c3a80414222327eebd5d51835.tar.gz CMake-8ddf32196c6bca9c3a80414222327eebd5d51835.tar.bz2 |
Tutorial: Refactor MathFunctions code
Propagate the refactor in Step 10 MathFunctions through all of the
steps. Use MathFunctions/MathFunctions.cxx instead of Tutorial.cxx
to determine which sqrt library is called. Adds .h files which
correspond to their .cxx files by name.
Diffstat (limited to 'Help/guide/tutorial/Step8/tutorial.cxx')
-rw-r--r-- | Help/guide/tutorial/Step8/tutorial.cxx | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/Help/guide/tutorial/Step8/tutorial.cxx b/Help/guide/tutorial/Step8/tutorial.cxx index b3c6a4f..a3a2bdc 100644 --- a/Help/guide/tutorial/Step8/tutorial.cxx +++ b/Help/guide/tutorial/Step8/tutorial.cxx @@ -3,13 +3,9 @@ #include <iostream> #include <string> +#include "MathFunctions.h" #include "TutorialConfig.h" -// should we include the MathFunctions header? -#ifdef USE_MYMATH -# include "MathFunctions.h" -#endif - int main(int argc, char* argv[]) { if (argc < 2) { @@ -23,12 +19,7 @@ int main(int argc, char* argv[]) // convert input to double const double inputValue = std::stod(argv[1]); - // which square root function should we use? -#ifdef USE_MYMATH - const double outputValue = mysqrt(inputValue); -#else - const double outputValue = sqrt(inputValue); -#endif + const double outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; |