summaryrefslogtreecommitdiffstats
path: root/Help/guide/importing-exporting/Downstream/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'Help/guide/importing-exporting/Downstream/main.cc')
-rw-r--r--Help/guide/importing-exporting/Downstream/main.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/Help/guide/importing-exporting/Downstream/main.cc b/Help/guide/importing-exporting/Downstream/main.cc
new file mode 100644
index 0000000..8574373
--- /dev/null
+++ b/Help/guide/importing-exporting/Downstream/main.cc
@@ -0,0 +1,23 @@
+// A simple program that outputs the square root of a number
+#include <iostream>
+#include <string>
+
+#include "MathFunctions.h"
+
+int main(int argc, char* argv[])
+{
+ if (argc < 2) {
+ std::cout << "Usage: " << argv[0] << " number" << std::endl;
+ return 1;
+ }
+
+ // convert input to double
+ const double inputValue = std::stod(argv[1]);
+
+ // calculate square root
+ const double sqrt = MathFunctions::sqrt(inputValue);
+ std::cout << "The square root of " << inputValue << " is " << sqrt
+ << std::endl;
+
+ return 0;
+}