Skip to content

Instantly share code, notes, and snippets.

@raarce
Created August 21, 2012 00:58
Show Gist options
  • Save raarce/3410109 to your computer and use it in GitHub Desktop.
Save raarce/3410109 to your computer and use it in GitHub Desktop.
Command line argument example 01
// Command line argument example #01
#include <iostream>
using namespace std;
int main ( int argc, char *argv[] )
{
if ( argc < 2 ) {
cout<<"usage: "<< argv[0] <<" <your name>\n";
exit(1);
} else {
cout <<"Hi ";
for (int i=1; i<argc; i++) cout << argv[i] << ".";
cout << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment