Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ language. please use comments to explain. Overview You will be given a string. You need to write the string character by character into a
c++ language. please use comments to explain.
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 perfect 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 periods 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. Output ./spiral input-inputl.txt output-Foutput1.txt HEL I!L H,0 inputl.txt HELLO, HI! input2.txt ./spiral input-input2.txt output-output2.txt ILOV TLEE A.ST EBEH ILOVETHEBEATLES input3.txt ./spiral input-input2.txt output-output2.txt KEEPA NMYNG 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