8

Possible Duplicate:
int to std::string?

How can you convert int to std::string?

Community
  • 1
  • 1
cps
  • 81
  • 1
  • 1
  • 2

1 Answers1

15

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;
}
naspinski
  • 34,020
  • 36
  • 111
  • 167