Jump to content

C++ Language/Std/Strings/CastingNumericValues/NumberToString

From Wikibooks, open books for an open world

Formatted-printed by sprintf(pcBuffer, "%d", 11); is an easy way to cast from a number into a string.

The more modern std::format("1+2={} and 4+5={}", 3, 9) outputs its formatted-string as a std::string object.

Additional information about casting from number to string (includes interactive examples)