What's wrong with my strcat function?

closed account (yqD8vCM9)
I'm writing a program that concatenates the strings in an 2D array. There are 200 strings.

Ex1: Tom Ford Jerry West Micheal Jordan Kenny Smith Sean Connery Tom Foolery ..
My function have to concatenate the strings by 2

Result: TomFord JerryWest MichealJordan KennySmith SeanConnery TomFoolery

I have a seperate function that displays it to screen but it looks different. It looks like this:

Ex2:TomFord Ford JerryWest West MichealJordan Micheal KennySmith Kenny SeanConnery Sean TomFoolery Tom.

It concatenates it alright but prints the prints name after. Why?
This only happens why i output it with a display function. If I cout it in my concatenate function it looks like the normal Result above.
myStrCat is just strcat().

1
2
3
4
5
6
7
8
9
10
11
void Concatenation( char dest[200][13] )
 {
   for(int i=0;i<200;i+=2)
     {
       myStrCat(dest[i],dest[i+1]); // myStrCat is basically the normal  
                                       // strcat().Just made my own.
      
       cout << dest[i] << " "; // displays normal result here.
     }

 }

1
2
3
4
5
6
7
8
9
void display( char names[200][13] )
{
  int i;

  for( i = 0; i < 200; i++ )
   {
    cout << names[i] << " "; // displays Ex2 here. Not want I want.
   }
}
Last edited on
Topic archived. No new replies allowed.