May 3rd, 2013, 03:45 PM
If you want to simply add 0s in front as needed, you can use std::cout along with std::setfill and std::setw()
std::cout << std::setfill('0') << std::setw(3) << number;
setw() sets the width of the output field and setfill() sets the character to pad the extra space with.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
Last edited by Scorpions4ever : May 3rd, 2013 at 03:52 PM.