码迷,mamicode.com
首页 > 其他好文 > 详细

int to str

时间:2015-08-08 17:54:22      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:

string int2str( int num)
{
if (num == 0 )
return " 0 " ;
string str = "" ;
int num_ = num > 0 ? num : - 1 * num;
while (num_)
{
str = ( char )(num_ % 10 + 48 ) + str;
num_ /= 10 ;
}
if (num < 0 )
str = " - " + str;
return str;
}

int to str

标签:

原文地址:http://www.cnblogs.com/dengpeng1004/p/4713397.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!