Topic: Justify L|R
Author: jpotter@falcon.lhup.edu (John Potter)
Date: 1999/04/23 Raw View
I accidently produced effectively the following and was pleasantly
supprised by the results.
cout.setf(ios::left | ios::right);
cout << setw(10) << "Hello" << '|' << setw(5) << 5 << endl;
The output was: (read . as fill character)
Hello.....|....5
Wow, strings left justified and numbers right justified. Amazed at
these results, I checked my other compilers and the standard.
One compiler agreed, one left justified both and one right justified
both. My reading of the standard gives the both left as certainly
wrong. I think the both right is correct but would like to see the
other two be right.
Checking the vintage of the compilers, it seems that the two that did
what I like are Cfornt based.
If I read correctly, the justification for strings (C or C++) is found
in the numeric section after the number has been converted to a string.
With that simplification of formatting, there is no way that the nice
results I found could be standard. There is only one table for
justification padding.
Did I get that right? Or, are the nice results (standard) possible?
John
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]