Created
May 9, 2018 06:02
-
-
Save kumpeishiraishi/6253be6be4acf3efa370201172fd9403 to your computer and use it in GitHub Desktop.
set width and set fill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
#include <sstream> | |
int main() { | |
int t = 58; | |
std::ostringstream ss; | |
ss << std::setw(5) << std::setfill('0') << t; | |
std::cout << ss.str() << std::endl; // -> '00058' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment