I am having trouble getting a jump start on this rather complicated program involving C++ classes and string manipulation in string classes.
I am attempting to write a C++ program that contains a Class called Encrypt. This should contain a line of text as its private data as well as an int type key. It should also contain methods capable of encrypting, decrypting or mixing text. It would also contain appropriate mutator and accessor methods. The constructor should have three flavours. No arguments, just text and text with a key.
In the main routine a user would be required to enter a line of text, have it encrypted and printed, decrypted and printed, and finally switched and printed. The key is to be hardcoded (the user will not enter the key value because the key will be hardcoded into the program by the programmer).
An example of how this should work is below:
The key is 4 and the user enters "It is very warm today" as their line of text. This would be encrypted to This would be encrypted to “Mx mw zivc aevq xshec". Theefore in this example, for the new text every letter is encrypted as four characters further along in the alphabet. A to E, B to F, C to G, W to A (wrapping around to the beginning).
Thus, the plan is to use the key as a circular encryption key. The letter 'a' becomes 'a' + key, 'b' becomes 'b' + key...'w' becomes 'w' + key which would wrap around to the start of the alphabet if the key is 4, 'w' would become 'a' which is four alpha characters after 'w'.
The user should be able to type in a line of text and then have displayed on the screen the encrypted text by the method of the example above, the screen should also display the decrypted text which is returning it back to it's original text as entered by the user, and lastly the switched text should be displayed.
The switched text part would be rotating the words to the right by # of characters in key value like this:
For example, if the key value is 4 with 'is' being key value 1, 'a' being key value 2, 'very' being key value 3 and 'warm' being key value 4:
"It is a very warm day" would become "warm day It is a"
Note that the key value count begins with the word to the right of the first word which is why the word 'warm' would be key value of 4 and not the word 'very'.
I just am looking for some sort of explanation on how I can go about doing this in C++ because attempting to write this out in code has been very tedious so far. Any assistance of any kind about how to do this would be so greatly appreciated.
This program's description is a little hard to understand so if anyone reads this and needs anything to be cleared up, I will reply back and describe it.