Program:
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
cout << "Number of arguments: " << argc << endl;
cout << "You type: ";
for (int c=0; c<argc; c++)
{
cout << argv[c] << " ";
}
cout << endl;
return 0;
}
Sample run:
> g++ a.cpp
> a.exe word2 word3 word4
Number of arguments: 4
You type: a.exe word2 word3 word4
No comments:
Post a Comment