For this week please read the rest of Chapters 4 and 5 in Overland. Some of it will be review, so fee free to skim those sections, but be mindful that there is also a lot of new information introduced.
This week is in a sense a continuation of last week in that you will cover more on functions, but it also introduces random number generation in C++. By the end of it you should know:
- How to declare and use recursive functions in C++.
- The basics of random numbers in C++.
- How strings are stored in C++.
- Syntax of multidimensional arrays in C++.
All the exercises from the reading except 4.3.3.
Write a program called cipher_functions2.cpp that builds on the cipher_functions.cpp program from last week by adding 4 new functions. Three of the functions should be to implement the additive, multiplicative, and affine ciphers, but the encoding should be done using a random key unknown to the user. I would suggest doing this by adding an extra parameter to the functions from last week that corresponds to the range of possible random values, generating a random number inside the new function, and then (still inside the new function) passing all the necessary information (including the random key) to the original function. |