how to convert int to string c++

#include <iostream>
#include <string>
using namespace std;

int main() {
   int num = 12345;
   string str = to_string(num);
   cout << "The string representation is: " << str << endl;
   return 0;
}