Converting Integers to Strings in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Converting Integers to Strings in C++?

Please help. Newbie here. How many ways are there to convert integers to strings in C++? Which is most convenient and has greater compatibility? Please help by listing the methods, their syntax and which situation they would be used in. Much appreciated!

14th Sep 2017, 4:27 AM
7EX1U5
7EX1U5 - avatar
4 Answers
14th Sep 2017, 4:34 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 6
std::to_string() is the easiest way but it doesn't work on SL compiler because its not fully C++11 compliant.
14th Sep 2017, 5:03 AM
Karl T.
Karl T. - avatar
+ 3
build your own function as a template function. you learn and you can use it for more than integers.
14th Sep 2017, 4:56 AM
Oma Falk
Oma Falk - avatar
0
Thanks guys! @Karl I tried using std::to_string but it didn't work. @Very_hard thanks for the code! much appreciated!
14th Sep 2017, 5:42 AM
7EX1U5
7EX1U5 - avatar