Replaced the code using std::to_string.