Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Help/guide/importing-exporting/Downstream/main.cc
5016 views
1
// A simple program that outputs the square root of a number
2
#include <iostream>
3
#include <string>
4
5
#include "MathFunctions.h"
6
7
int main(int argc, char* argv[])
8
{
9
if (argc < 2) {
10
std::cout << "Usage: " << argv[0] << " number" << std::endl;
11
return 1;
12
}
13
14
// convert input to double
15
double const inputValue = std::stod(argv[1]);
16
17
// calculate square root
18
double const sqrt = MathFunctions::sqrt(inputValue);
19
std::cout << "The square root of " << inputValue << " is " << sqrt
20
<< std::endl;
21
22
return 0;
23
}
24
25