Centering text of output
Did a search and came up empty. Also hunted on google but nothing of consequence. Does anyone have the answer on how to center the output (text)? The output is just the name of some states and such, nothing complicated. I would post my code but it is lengthy and I don't think it would help. Thanks in advance!
not sure what you mean by centering text of output. is this output to the console or to a file? if you want to center output, it will have to be dependent on the width of whatever it is output to. for one, i know not all files or consoles have a limit on line length. if you really wanna look further into it, you just have to indent each line with some kind of ratio dependent on a max line length and the length of the line to be output. where you get this length is up to you.
Find the center of the output area.
Find the center of the text to be output.
Align one center with the other center.
Take a piece of paper, draw the two items and generate the formula for the distance from the left edge of the output area to the left edge of the text.