This may not be the case, but I suspect the cause is one of the following:
--Concatenation is including the terminating null character,
--The size isn't being updated after the concatenation (pass the size variables by reference and modify them inside the function)
--The arrays allocated memory is unable to contain all of the concatenated content.
Seeding the rng can be read about here:
--Note: easy way to seed the rng (do this once on each program run)
Below are some tips for C++, which will make things a LOT easier for you. I strongly recommend you become familiar with them, but dont rush too much. Try using the string class for now, and you can play with vectors later, if you bite more than you can chew you'll quickly get sick of programming.
srand ( time(NULL) );
Since you are using C++, I strongly recommend using the string class, instead of c-style strings. The string class automatically manages the size, it simplifies usage with the functions given, and (this one is important), it acts as a wrapper. Read about it here:
example string declaration: "std::string myString = "Hello World!";"
And, in cases like this, the vector class is also very useful. It acts similar to arrays, but also contains the size, and you dont have a fixed size. Example declarations of a vector:
"std::vector<std::string> myStrings; "
"std::vector<int> myInts; "
Read these examples and then try to use a vector, it greatly simplifies situations like this.
I know thats a lot of reading, but it is well worth it. Good luck!