| How do you make cout do columns? |
by oot |
2004-12-06 14:52:31 |
| I have an object that has four fields: a six-digit number, a 0-20 character email address, a 12-character phone number, and a 0-30 character name. When the email address or name is less than its maximum width, I would like to pad it with spaces to that maximum width so it shows up in columns when I display a bunch of these objects. How do I make cout do that? |
|
[ Reply ] |
|
Simplest way is via 'manipulators'. | by williamashbless | 2004-12-06 14:56:35 |
|
Thank you! :-) | by oot | 2004-12-06 14:57:37 |
|
Hmm, interesting. | by LionsPhil | 2004-12-06 15:00:12 |
|
oot specifically asked about cout... | by williamashbless | 2004-12-06 15:03:22 |
|
Bah! | by LionsPhil | 2004-12-06 15:04:29 |
|
*shiver* *LARTs LionsPhil* (n/t) | by williamashbless | 2004-12-06 15:07:50 |
|
Foo *x = new Foo(malloc(23)); >=) (n/t) | by LionsPhil | 2004-12-06 15:09:35 |
|
*LART* *LART* *LART* (n/t) | by williamashbless | 2004-12-06 15:11:30 |
|
*joins in the LARTing* (n/t) | by DaNutBall | 2004-12-06 15:14:40 |
|
Hmm | by Liava | 2004-12-06 15:17:16 |
|
I think you made a boo-boo. | by LionsPhil | 2004-12-06 15:25:27 |
|
Nope, I meant what I wrote. | by Liava | 2004-12-06 15:26:04 |
|
free(bar)? | by wheresthefish | 2004-12-06 15:31:20 |
|
struct mug *fishpint=malloc(sizeof(struct mug)); | by LionsPhil | 2004-12-06 15:35:47 |
|
*giggle* You guys are awesome! (n/t) | by oot | 2004-12-06 17:55:59 |
|
My head a splode! (n/t) | by oot | 2004-12-06 15:21:14 |
|
So, if you mix them 50/50, is that just C+? *flee* (n/t) | by Merlin | 2004-12-06 15:09:18 |
|
Anyway, C++ is only C with cout and a .cc filename (n/t) | by wheresthefish | 2004-12-06 15:16:44 |
|
Heh, indeed | by Liava | 2004-12-06 15:18:21 |
|
and new, and delete, and that "object" stuff... | by bobmon | 2004-12-06 15:20:32 |
|
Objects are for people who can't write functions. | by wheresthefish | 2004-12-06 15:29:32 |
|
Header file? HEADER FILE? | by LionsPhil | 2004-12-06 15:33:28 |
|
Functions are for people who can't keep their spag | by bobmon | 2004-12-06 15:47:15 |
|
OK, where did I put that | by ManiacJoe | 2004-12-06 15:58:42 |
|
That is so vulgar | by Ston | 2004-12-06 16:05:51 |
|
Rubbish! | by LionsPhil | 2004-12-06 15:26:57 |
|
Ran out of characters on the subject line. | by wheresthefish | 2004-12-06 15:34:58 |
|
Prof of mine did that for an entire course | by phezult | 2004-12-06 15:23:06 |
|
A question because I'm curious: | by phezult | 2004-12-06 15:02:22 |
|
That's precisely the reason. | by williamashbless | 2004-12-06 15:07:22 |
|
What I've always wondered | by phezult | 2004-12-06 15:20:47 |
|
That's exactly what later software design... | by williamashbless | 2004-12-06 15:33:02 |
|
For grading purposes: what happens if a student.. | by bobmon | 2004-12-06 15:35:11 |
|
In the computer architectire course I'm TAing... | by nix | 2004-12-06 15:40:42 |
|
Good approach. Ideally, put only the object files | by bobmon | 2004-12-06 15:52:12 |
|
That's a big reason | by ToLazyToThink | 2004-12-06 15:11:05 |
|
I'm using gcc | by oot | 2004-12-06 15:19:13 |