Posted on 2006-10-22
I have a simple question regarding how to perform some formatting in c++. I know you can use setw(xx) or width(), but when i have the following case below, things get out of hand:
Basically i want to able to line things up, so in the above example i would like the number 10 to be lined in the same column as the one before, but this does not seem to be happening. I've currently got code like this:
cout << "Text" << setw(10) << 10<< endl;
cout << "MoreText" << setw(10) << 10<< endl;
Is their a way round this? I know the reason why this is happending, but dont know of a way to control formatting of this nature.