+ 3
How to convert a float/int... to a string in C++?
Hi guys, I am using std::string class and I don't know how to convert a float/int to a string or how to concateniate them in one string , I need your help please đ BTW , I am using code::blocks 16.01
4 Answers
+ 3
sprintf : I read something about it but I don't know if it'll work in C++ .
the to_string method doesn't work with my IDEđ
Anyway , thank you , I already fixed the problem
+ 2
sorry I found the solution đ
for those who don't know how , we will use this function ( nb2string ):
#include< sstream>
using namespace std ;
template <class T> string nb2String(T nb)
{
ostringstream s;
s << nb;
return s.str();
}