Jackson Kaminski wrote:
> The reason I am using the resize is because this input is one of two that I 
> am going to put together into one record of a specific size. They will have 
> the form of: "urgency level : description", and I was hoping to have the 
> 'description' part all lined up by making the 'urgency level' part be a 
> static 4 characters long. There is perhaps a better way of doing this?
>   

There is. Both the printf function and iostream objects have the ability 
to format output, to include lining up on specific columns or field 
widths. You could write a simple bit of code to determine the widest 
value in each field, and use this to line up the second field. In fact 
doing it this way is better, being more dynamic, because it can handle 
future changes or additions to the code without requiring retooling your 
existing code. What if you add a new urgency level with a wider 
description? Hard coding this value or making them all the same width 
will only require more work later.

-- 
John Gaughan

Reply via email to