Created
August 21, 2012 00:58
-
-
Save raarce/3410109 to your computer and use it in GitHub Desktop.
Command line argument example 01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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