My program is supposed to read an encrypted file from the command-line, but I don't know how to pass command-line arguments. These are the instructions:
*A shift cipher is a very basic cryptographic algorithm in which encryption is performed by substituting each character in the plaintext with the character that's a fixed number of characters (i.e. the shift value) later in the alphabet. For example, if our shift value is 2, the plaintext cabbage becomes ecddcig.
It's easy to see that shift ciphers are so weak because there are only 26 possible ways to shift (and one of those 26 is the same as not shifting at all). Your program should read at the command line the name of a file that has been encrypted with a shift cipher. It will decrypt the file using all of the possible shift values and then deciding which of the shift values is correct. The shift value that the program decides is correct is the one which, when applied, results in the highest percentage of the file's words appearing in the dictionary. *
I've written functions to shift the characters in a string by n, a function to determine whether a given word appears in the dictionary, and a function to split a string into tokens.
mainfunction? Theargcandargvarguments I'm sure you've seen before? Those contains the arguments passed on the command line. I suggest you experiment with those, printing out the values ofargc, as well as loop from zero toargcand print out the corresponding entry in theargvarray../my_program /some/path/to/my/file. This file-name will then be inargv[1]as a string ("/some/path/to/my/file"). Remember to check thatargcis at least2first though.