// // Program name: echo1perline // Author: B. Massingill // // Purpose: echo command-line arguments, one per line // // Input: // command-line arguments. // note: by convention, the first command-line argument is // always the name by which the program was invoked. // Output: // echoed command-line arguments, one per line. // #include #include // has EXIT_SUCCESS using namespace std; // parameters for main program: // argc -- number of command-line arguments. // argv -- array of character strings representing command-line // arguments. each element -- argv[0] through // argv[argc-1] -- is a C-style string, i.e., a // null-terminated array of chars. int main(int argc, char *argv[]) { for (int i = 0; i < argc; ++i) cout << "Command-line argument " << i << ": " << argv[i] << endl; return EXIT_SUCCESS; }