you could just use itoa() or sprintf() as has been mentioned. But here's a better version of your function:
std::string get_value(int value)
{
std::string result = "";
if (value < 0)
{
value *= -1;
result = "-";
}
do
{
int digit = value % 10;
value /= 10;
result = (char)(digit + (int)'0') + result;
} while (value > 0)
result = result.reverse();
return result;
}
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun