Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Tests / Tutorial / Step7 / tutorial.cxx
blob82b416f11bb2bdb1cae4f0266588ea46fd77a064
1 // A simple program that computes the square root of a number
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <math.h>
5 #include "TutorialConfig.h"
7 #ifdef USE_MYMATH
8 #include "MathFunctions.h"
9 #endif
11 int main (int argc, char *argv[])
13 if (argc < 2)
15 fprintf(stdout,"%s Version %d.%d\n",
16 argv[0],
17 Tutorial_VERSION_MAJOR,
18 Tutorial_VERSION_MINOR);
19 fprintf(stdout,"Usage: %s number\n",argv[0]);
20 return 1;
23 double inputValue = atof(argv[1]);
25 #ifdef USE_MYMATH
26 double outputValue = mysqrt(inputValue);
27 #else
28 double outputValue = sqrt(inputValue);
29 #endif
31 fprintf(stdout,"The square root of %g is %g\n",
32 inputValue, outputValue);
33 return 0;