How can I pad an int with leading zeros when using cout

I want cout to output an int with leading zeros, so the value 1 would be printed as 001 and the value 25 printed as 025. How can I do this?

7 Answers
7

Leave a Comment