Where would you not get it int argv[]? The second argument mainis char* argv[].
You can convert these command line arguments from string to integer using strtolor with floating point using strtod.
For instance:
a=strtol(argv[1], nullptr, 0);
b=strtol(argv[2], nullptr, 0);
But you cannot just change the parameter type, because the operating system will give you command line arguments in string form, whether you like it or not.
. #include <stdlib.h> ( #include <cstdlib> using std::strtol;) strtol.
, strtol atoi. , , . NUL, . , , , argc, , argv.
:
char* endp;
a = strtol(argv[1], &endp, 0);
if (endp == argv[1] || *endp) { }