C++ main() Print the arguments to the program to the standard output

Description

C++ main() Print the arguments to the program to the standard output

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
    cout << "The arguments to " << pszArgs[0] << " are:\n";

    for (int i = 1; i < nNumberofArgs; i++)
    {// www.ja  v a 2s . com
        cout << i << ":" << pszArgs[i] << "\n";
    }

    cout << "That's it" << endl;

    return 0;
}



PreviousNext

Related