Jump to content

I want to know what the syntax code for the evenly spacing. Like in this picture {0) gallon-milk   1)ice} or {lotion 4.99 andice-5lbs .99} . and so on. I know it not setw or setpercision cause i try unless it a combo of them which i do not know how. I also try searching on the web and saw only setw. That doesn't explain much.

 

Spoiler

U1.png

 

Link to comment
https://linustechtips.com/topic/702725-evenly-spacing-in-c/
Share on other sites

Link to post
Share on other sites

You need to use setfill(' ') before setw. From (to insert leading 0's): http://stackoverflow.com/questions/1714515/how-can-i-pad-an-int-with-leading-zeros-when-using-cout-operator

 

Quote

cout << setfill('0') << setw(5) << 25;

output:
00025

 

Link to comment
https://linustechtips.com/topic/702725-evenly-spacing-in-c/#findComment-8985403
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×