开发者

convert int to std::string [duplicate]

This question already has answers here: Closed 12 year开发者_StackOverflow社区s ago.

Possible Duplicate:

int to std::string?

How can you convert int to std::string?


you can use stringstream; stole this from here:

#include <iostream>
#include <sstream>

int main() {
  int number = 123;

  std::stringstream ss;
  ss << number;

  std::cout << ss.str() << endl;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜