How to output something like this in c++? (first part of each line is left aligned, second part is right aligned)
********* **
******* ****
******* ****
********** *
This is a discussion on a question about output within the C++ Programming forums, part of the General Programming Boards category; How to output something like this in c++? (first part of each line is left aligned, second part is right ...
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 f6ff
Well, are you asking about input or output?Originally Posted by f6ff
I used to be an adventurer like you... then I took an arrow to the knee.
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