I want to add a variable of leading zero\'s to a string. I couldn\'t find anything on Google, without someone mentioning (s)printf, but I want to do this without (s)printf.<
The C++ way of doing it is with setw, ios_base::width and setfill
#include #include using namespace std; int main() { const int a = 12; const int b = 6; cout << setw(width) << row * col; cout << endl; return 0; }