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 common 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 I F Y O U W A N T T O K
N O W W H A T A M A N S
L I K E T A K E A G O O
D L O O K A T H O W H E
T R E A T S H I S I N F
E R I O R S N O T H I S
E Q U A L S J K R O W L
I N G # # # # # # # # #
INLDTEEI FOILRRQN YWKOEIUG OWEOAOA UHTKTRL WAAASSS ATKTHNJ NAEHIOK TMAOSTR TAGWIHO ONOHNIW KSOEFSL
Hints: You will be making heavy use of the string class to parse the message and insert it into the 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
