C++ main() Display command-line arguments

Description

C++ main() Display command-line arguments

#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
   int i;//from   ww w.j a  v a 2  s .  co m
   cout << "\nThe following arguments were passed to main(): ";
   for (i = 0; i < argc; i++)
      cout << argv[i] << " ";
   cout << endl;
   return 0;
}



PreviousNext

Related