how to convert an int to a string in cpp code example Example: convert int to string c++ int x = 5; string str = to_string(x);