Saturday, October 19, 2013

Print all values passed by commandline arguments in C++

Program:

//disp.cpp
#include<iostream.h>    
#include<conio.h>
int main(int args,char *argv[])
{
for(int i=0;i<args;i++)
cout<<"\n"<<argv[i];
getch();
return 0;
}

Output:

disp.c Hai hello

Hai
hello

No comments: