SyntaxFix
Write A Post
Hire A Developer
Questions
In C++20 you'll be able to do:
std::cout << std::format("{:03}", 25); // prints 025
In the meantime you can use the {fmt} library, std::format is based on.
std::format
Disclaimer: I'm the author of {fmt} and C++20 std::format.