I'm reading a list of values from a text file and storing them into a vector. The list of values I read are: 13 21 5 37 15. I'm storing these values in one vector. I want to reverse each individual value so that I can store them in a second vector as: 31 12 5 73 51. I tried using a reversing method but it didn't work.
std::string IntToString( constint& num )
{
std::stringstream ss;
ss << num;
return ss.str()
}
std::string ReverseString( const std::string& str )
{
/*
have a look at the iterators in the string class
especially, the reverse iterators
http://www.cplusplus.com/reference/string/string/string/ (7)
*/
return std::string{ }
}
// use std::stoi() to convert the reversed string back into an int