Question: Square code is a simple transposition cipher that utilizes a square (or rectangle) arrangement of your plain text to create a ciphertext. You will write
Square code is a simple transposition cipher that utilizes a square (or rectangle) arrangement of your plain text to create a ciphertext. You will write a program that allows the user to type a message of any length, then encode it using an appropriately sized 2D array.
Requirements:
Name the source file for your program program8.cpp.
Prompt the user to type in a message
You must strip all whitespace and common punctuation marks * Tabs, spaces, new lines, and carriage returns count as white space
* Period, comma, apostrophe, exclamation mark, and question mark count as com- mon punctuation
The message will then be inserted into a dynamic 2D array. The dynamic array will always have 12 columns
It is up to you to determine how many rows are required
You are only expected to encode the message
A sample run of your program shall look like: NOTE: The message and encoded output are both just one line, breaks were added for visibility NOTE: The # are actually in the array
Enter a message to be encoded: If you want to know what a man's like, take a good look at how he treats his inferiors, not his equals. J.K. Rowling
IFYOUWANTTOK
NOWWHATAMANS
LIKETAKEAGOO
DLOOKATHOWHE
TREATSHISINF
ERIORSNOTHIS
EQUALSJKROWL
ING#########
INLDTEEI FOILRRQN YWKOEIUG OWEOAOA UHTKTRL WAAASSS ATKTHNJ NAEHIOK TMAOSTR TAGWIHO ONOHNIW KSOEFSL
Hints:
Youwillbemakingheavyuseofthestringclasstoparsethemessageandinsertitintothe array
Familiarity with some string class function will be very beneficial Functions such as find_first_of() or find_last_of(), and erase()
A dynamcic 2D array requires special care to set up and properly destroy
No functions are required, but they should be used
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
