开发者

convert int to std::string [duplicate]

开发者 https://www.devze.com 2023-01-10 08:17 出处:网络
This question already has answers here: Closed 12 year开发者_StackOverflow社区s ago. Possible 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

精彩评论

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