Answered step by step
Verified Expert Solution
Question
1 Approved Answer
***PLEASE DO IT IN C++*** SPIRAL Overview You will be given a string. You need to write the string character by character into a matrix
***PLEASE DO IT IN C++***
SPIRAL Overview You will be given a string. You need to write the string character by character into a matrix in a clockwise spiral pattern towards the center starting from the upper left corner. The length of the given string is not guaranteed to be a perfeet square, meaning that not all strings will perfectly spiral towards the center. Some strings will run out of characters before it reaches the center of the matrix. For example, the string length could be 32. You have to find the closest square number that is larger than the string length. In this case it is 36. You will get the square root of the string length, giving you the dimensions of the matrix. In this example, the size will be six by six. As you build the spiral, you will run out of characters to put into the matrix before you finish. However, keep spiralling towards the middle anyways and write period:s instead. The string will not have any spaces and will contain letters, numbers, and basic punctuation marks. Each input file will only have one string. Input inputi.txt HELLO, HI! Output ./spiral input-inputi.txt output=output| . txt HEL I!L H,0 ./spiral input-input2.txt output=output2.txt ILOV TLEE A. ST EBEH input2.txt ILOVETHEBEATLES ./spiral input-input2.txt output-output2.txt KEEPA NMYNG input3.txt KEEPAGOLDCHAINONMYNECK N. KCL IAHCDStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started