int main() { ... }
#includeworks, but produces a warning.using namespace std; int main(int argc) { cout << "There were " << argc << " arguments " << endl; return 0; }
#includeusing namespace std; int main(int argc, char * argv[]) { int i; cout << "The program is " << argv[0] << endl; if (argc > 1) { cout << "The command line arguments are: " << endl; for(i=1;i<argc;i++) { cout << "\targument number " << i+1 << " is \"" << argv[i] << "\"" << endl; } } return 0; }
if (strcmp(argv[i], "?") == 0) { Usage(argv[0]); i++; }