mirror of
https://github.com/reactos/CMake.git
synced 2025-05-14 10:35:48 +00:00

* Update minimum required version to 3.10 * Use VERSION argument to project command rather than separate variables * Replace `endif(USE_MYMATH)` with more modern `endif()` * Simplify the call to 'configure_file()' * Add comments to tutorial.cxx to use as anchors in documentation * Remove CMakeLists and TutorialConfig.h.in files that users should create. Consequently, remove Step1 from CMake tests.
23 lines
537 B
C++
23 lines
537 B
C++
// A simple program that computes the square root of a number
|
|
#include <cmath>
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
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 = atof(argv[1]);
|
|
|
|
// calculate square root
|
|
const double outputValue = sqrt(inputValue);
|
|
std::cout << "The square root of " << inputValue << " is " << outputValue
|
|
<< std::endl;
|
|
return 0;
|
|
}
|