Demonstrate command-line arguments - C++ Function

C++ examples for Function:main function

Description

Demonstrate command-line arguments

Demo Code

#include <iostream>
using namespace std;
int main(int argc, char* argv[] )
{
   cout << "\nargc = " << argc << endl;  //number of arguments
   for(int j=0; j<argc; j++)             //display arguments
      cout << "Argument " << j << " = " << argv[j] << endl;
   return 0;//from w  w w  .  jav a2  s.  c  o  m
}

Result


Related Tutorials