更新时间:2023-02-18 10:20:29
或使用stringstreams:
or using the stringstreams:
stringstream ss;
ss << setw(10) << setfill('0') << i;
string s = ss.str();
我编译了在 arachnoid.com ,因为我喜欢iostreams的类型安全的方式更多。此外,您可以在任何其他输出流上同样使用此代码。
I compiled the information I found on arachnoid.com because I like the type-safe way of iostreams more. Besides, you can equally use this code on any other output stream.