Click to See Complete Forum and Search --> : setw() q.
tecknophreak
08-22-2001, 03:46 PM
yeah, my brain don't work, or didn't last night.
cout << setw(10) << "Hello" << setw(10) << "Bye" << endl;
with iomanip, iostream of course, here's the output:
HelloBye
Shouldn't it be
Hello Bye
?
Did I miss something?(feel so stupid) :confused:
debiandude
08-22-2001, 04:14 PM
shouldn't it be:
cout << setw(10) << "Hello" << setw(10) << " Bye" << endl;
I mean that gets you the space, other that than I don't do c++ so I don't know what those setw(10)'s are. Set widths possibly?
TheLinuxDuck
08-22-2001, 04:42 PM
teck: <-- (aye!? aye!?)
I can't reproduce the problem. Using
#include <iostream.h>
#include <iomanip.h>
int main(void)
{
cout << setw(10) << "Hello" << setw(10) << "Bye" << endl;
return 0;
}
my output is
/home/root/cpp/teck> ./output
Hello Bye
?? Not sure why it would be weird. What version of gcc are you using?
[ 22 August 2001: Message edited by: TheLinuxDuck ]
tecknophreak
08-23-2001, 08:21 AM
Not sure, just put slack on the comp at home, and of course, i'm at work now. ;) shhh..don't tell nobody. I'll tell you this, it's annoying.
I've got slack 7.1 on disks. I'm not sure what version that is, I'll have to put 3.0 on this weekend. Just checking if I forgot anything. thanx