J. Lily J. Lily - 6 months ago 38
C++ Question

output alignment issues in c++

I want to have these aligned but the strings are giving a problem. I have tried using left but it doesn't work here.

table preview

Answer Source

Let me guess, you're using tabs to separate the columns? The problem with this is that is has no justification (left or right), and it depends on the length of previously printed output since tabs are at fixed positions in the output, i.e. tabs are variable width.

If you want a fixed column width then you should use the std::setw manipulator.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download