I've read all the corresponding material in the book and have no clue what to do. Any help would be appreciated.
Here are the instructions:
Rewrite the program(The program that needs to be re-written is the code below) so that the input is passed on the command line when the program is executed. Do the work in functions. Be sure to check that the proper number of parameters were passed. If the proper number of parameters were not passed: display a usage statement to the standard error device, and exit the program with a non-zero return code.
I don't even know what it means by passes and parameters.
You're going to need to employ another definition of main:
int main(int argc, constchar* argv);
Where argc is the number of arguments and argv is a pointer to the first argument. Windows always sends the program's path as the first argument, so argc will always be >= 1. Any additional arguments sent will follow.
1 2 3 4 5 6 7 8
int main(int argc, constchar* argv)
// Prints each argument on the command line.
for(int i = 0; i < argc; ++i)
std::cout << "argument " << i << ": " << argv[i] << std::endl;