The command-line consists of C-style strings; to use any C++ string functions from the standard library, first assign the array element (argv[i]) to a local string variable. Once you've converted the C-string argument to a C++ string, you may then treat the argument as a number by converting it with the stoi(), stol() and stod() function in the <string> header.
However, you may convert directly from C-style strings to numbers, with out first converting to string, by using the helper functions in <cstdlib> which include atoi(), atol(), and atof().
#include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc, char *argv[])
{
for (int i = 1; i < argc; ++i)
cout << atoi(argv[i]) << endl;
}
Notice that loop starts at 1 to skip over the program name at argv[0]. If you pass a floating-point number on the command line, atoi() takes only the digits up to the decimal point. If you pass non-numbers, these come back from atoi() as zero.