linux3[87]% make
g++ -Wall proj1.cpp -o program
proj1.cpp: In function ‘int main()’:
proj1.cpp:9: error: invalid conversion from ‘const char*’ to ‘char*’
proj1.cpp:9: error: initializing argument 1 of ‘void Decipher(char*, char)’
proj1.cpp: In function ‘void Decipher(char*, char)’:
proj1.cpp:20: warning: comparison between signed and unsigned integer expressions
proj1.cpp:27: warning: comparison between signed and unsigned integer expressions
proj1.cpp:17: warning: unused variable ‘intMessage’
proj1.cpp:18: warning: unused variable ‘cipherFinal’
make: *** [program] Error 1
the header file has MAXMSGLEN equal to 80.
it also contains "const char cipher[NUMMSGS][MAXMSGLEN]" and then defines all of the sentences. [0][1] would be the first letter of the first sentence.
the functions in the header are this.
/******************************************************
Decipher() - decipher a Caesar-enciphered mesage.
Preconditions: cip[] is char array of maximum
length MAXMSGLEN containing a cipher message as
a null-terminated C-string. key is a capital
letter (A-Z) and is the Caesar cipher key.
Postconditions: cip[] is overwritten with the
deciphered message.
******************************************************/
void Decipher(char cip[], char key);
and this
/******************************************************
SolveCipher() - decipher a Caesar-enciphered mesage
trying all possible keys and checking if the
beginning of the decrypted messages matches one of
the cribs. If so, return the key and return the
deciphered message in the dec parameter.
Preconditions: cip is a char array of maximum
length MAXMSGLEN which contains the cipher
message; dec is a char array of length MAXMSGLEN.
Postconditions: Returns the key if the deciphered
message begins with a crib; returns '\0'
otherwise. If the key is non-zero, the
deciphered message is returned in dec.
******************************************************/