subject

One method of encoding messages is known as the "expanding square code". this method encodes message by placing the character of the message in an odd order square matrix row by row, and then retrieving them in a clockwise expanding square spiral from the center of the matrix. if the message is not exactly the right length to fill the matrix, the rest of the matrix is filled with asterisk characters (*). for example, the two square matrices below show the order in which the characters are placed in the matrix, and the order in which they are retrieved. notice that the order of retrieval begins at the center, then proceed to the right, and then spirals clockwise order in order out 1 2 3 4 5 21 22 23 24 25 6 7 8 9 10 20 7 8 9 10 11 12 13 14 15 19 6 1 2 11 16 17 18 19 20 18 5 4 3 12 21 22 23 24 25 17 16 15 14 13 message in: "this is a test " message out: "stssees a a* " your program must be able to encode messages by this method. the input (from standard in) will consist of a string of text entered by the user, containing an unknown number of characters n (0 < n < = 1000). from the length of the message, you should determine the minimum odd order required for the matrix, and perform the specified operation. the output for you program will be the encoded message.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 03:00
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
Answers: 3
question
Computers and Technology, 23.06.2019 03:30
In vista and windows 7, the appearance and personalization option allows you to change the
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
question
Computers and Technology, 23.06.2019 20:50
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
You know the right answer?
One method of encoding messages is known as the "expanding square code". this method encodes message...
Questions
question
Social Studies, 01.07.2019 09:50
question
Mathematics, 01.07.2019 09:50
Questions on the website: 13722363