Hey does any one know of a (preferably simple) formula for justifying text into a column? Or maybe someone can fix mine?
I have to write a prog in C to do this, I have the program all written out, but my output isn't as I would like it...
I calculate the number of spaces that should be between each word in a line using this:
spaces = ( m - c ) / (w - 1)
m = maximum number of characters in line (e.g. column width)
c = the number of characters in the line I want to print (basically a combination of the lengths of all the words in the line)
w = number of words in the line
I think a lot of my problem may lie in that this fraction wouldn't always be coming out to a whole number and you can print say .3 of a space...