Write a function that reads an integer n and several lines of text (sentences between 150 – 200 characters). The text will be printed n characters per line, by adding extra spaces as evenly as possible.
For example:
Enter an integer (maximal number of chars per line): 10
Enter some sentences (between 150 – 200 chars): Your favorite forums are a dynamic listing of forums you're subscribed to as well as the the top forums that you post in. You currently don't have any favorite forums. You can visit the forum index for a listing of all forums.
Formatted text:
"Above paragraph will split for each line contains 10 characters"
I have a idea such we will define a counter(n) then set an for loop that run from 0 to n, then when it reached to less than n, we will insert a new line character '\n' to the position [n++]. After that, we will reset the for loop and for the next time, we have to start at inserted position until initial array of string still don't reach '\0'
I still have a problem at the step insertion, I really don't know how to come with syntax. Can you help me dear friends? Thank you so much