How to output something like this in c++? (first part of each line is left aligned, second part is right aligned)
********* **
******* ****
******* ****
********** *
How to output something like this in c++? (first part of each line is left aligned, second part is right aligned)
********* **
******* ****
******* ****
********** *
Last edited by f6ff; 04-03-2006 at 04:43 PM.
Originally Posted by f6ffWell, are you asking about input or output?Originally Posted by f6ff
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
The console uses fixed width font, so to align something to the right you will probably just have to figure out how many spaces to add between the characters on the right and the ones on the left. That should only take some pretty simple math.
It's outputOriginally Posted by hk_mp5kpdw
I tried this to make ptr->count organizing, but not working
Code:cout <<setw(30-(ptr->data.size()))<< ptr->data <<setw(30)<<ptr->count
I don't think you need to use setw for this. Why not just calculate the number of spaces required and output them in a loop?
that will work, thanksOriginally Posted by Daved