Increment a numerical string: Difference between revisions
m
→{{header|C++}}: Used library template, fixed compiler link
m (→{{header|C++}}: Used library template, fixed compiler link) |
|||
Line 30:
=={{header|C++}}==
{{library|STL}}
// STL with string stream operators
#include <cstdlib>
Line 41:
if (oss << i) s = oss.str();
{{library|Boost}}
// Boost
#include <cstdlib>
Line 51:
s = boost::lexical_cast<std::string>(i);
{{library|Qt}}
// Qt
QString s = "12345";
Line 64:
{{Library|MFC}}
// MFC
CString s = "12345";
Line 73:
All of the above solutions only work for numbers <= INT_MAX. The following works for an (almost) arbitrary large number:
'''Compiler:''' [[
#include <string>
|