c++ 如何将int 转换为string

int testi=9;

string  tests=std::to_string(testi);

如果不能运行,修改 makefile  CXX=g++ -std = c++11

 

char c[1024];

int num=0;

sprintf(c, "%d", num);

 

//也可以用snprintf

snprintf(c, 1024,"%d", num);

 

posted @ 2015-04-22 19:27  xiaoxiaowenge  阅读(549)  评论(0编辑  收藏  举报