I'm trying to write a program that will count the number of different possible passwords using the digits 0 - 9 under certain constraints. It's to have one required command line argument, which will be the number of digits in the password, while also having an optional argument, which will be the prohibited digit. No argument inputted will mean that all digits are allowed.
For example, should my program be called combinations:
$ combinations 8 3 #find number of passwords of length 8 with '3' not allowed
int myfunction( int optional = 3);
Command line arguments are passed from the command line into your program as parameters to your
main function. The signature of which needs to be
int main(int argc, char** argv).
The second parameter is an array of null terminated strings which hold every argument passed in the invocation of the program (including the name of the program). The first is is how many strings are in the array.
You will need to check that
argc > 2 and then parse
argv for the digit.