DevAcademia lesson/C++ Basics
Numbers and Strings
Topic progressTopic 27 of 109 - 25% complete
~4 min lesson13 learning blocks3 code examples1 checks/interactions
Lesson outline
Converting Numbers to Strings
To combine numbers with strings, convert the numbers to string form first. Since C++11, the to_string() function makes this simple:
String to Number Conversion
To convert strings back to numbers, use these functions from :
Formatting Numbers in Strings
For more control over how numbers are represented in strings, use ostringstream with manipulators:
Was this topic clear?