I need to get a string array and add a random number to it then sort it. What is the easiest way of doing this. do I need to convert the last element which will be the random number to an int then sort it that way or how.

I guess you mean that you want to append a random number to a string array?

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

int main()
{
    string s = "Hello World";
    int rnd = rand();
    stringstream stream(s);
    // append the random number to the string
    stream << rnd;
    // display the result
    cout << stream.str() << "\n";
    return 0;
}

>> then sort it
Sort the strings as normal strings, or sort them in ascending order by the random numbers that were appended to the string?