How to output something like this in c++? (first part of each line is left aligned, second part is right aligned)
********* **
******* ****
******* ****
********** *
Printable View
How to output something like this in c++? (first part of each line is left aligned, second part is right aligned)
********* **
******* ****
******* ****
********** *
Quote:
Originally Posted by f6ff
Well, are you asking about input or output?Quote:
Originally Posted by f6ff
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 outputQuote:
Originally 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, thanksQuote:
Originally Posted by Daved