Tests: Update CMake tutorial

Latest material from data.kitware.com -> Collections -> Courses -> CMake.
This commit is contained in:
Betsy McPhail
2019-01-20 11:28:39 -05:00
parent 438651506a
commit f2ddedfa58
112 changed files with 3118 additions and 623 deletions
+12 -13
View File
@@ -1,8 +1,9 @@
// A simple program that computes the square root of a number
#include <cmath>
#include <iostream>
#include <string>
#include "TutorialConfig.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef USE_MYMATH
# include "MathFunctions.h"
@@ -11,23 +12,21 @@
int main(int argc, char* argv[])
{
if (argc < 2) {
fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR,
Tutorial_VERSION_MINOR);
fprintf(stdout, "Usage: %s number\n", argv[0]);
std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "."
<< Tutorial_VERSION_MAJOR << std::endl;
std::cout << "Usage: " << argv[0] << " number" << std::endl;
return 1;
}
double inputValue = atof(argv[1]);
double outputValue = 0;
double inputValue = std::stod(argv[1]);
if (inputValue >= 0) {
#ifdef USE_MYMATH
outputValue = mysqrt(inputValue);
double outputValue = mysqrt(inputValue);
#else
outputValue = sqrt(inputValue);
double outputValue = sqrt(inputValue);
#endif
}
fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
return 0;
}