title: concatenating two strings c++
body: <p>im trying to stick two strings together without using + operator,also using loops to to that.the problem is after when it read two strings it couldnt print the second string and only the first string appears.
  here is my code
  this code is like copying two strings in one.</p>
  
  <pre><code>char str1[MAX];
  char str2[MAX];
  
  cout&lt;&lt;"Enter The first String:\n";
  cin.getline(str1,MAX,'\n');
  cout&lt;&lt;"Enter the second String:\n";
  cin.getline(str2,MAX,'\n');
  
  char str3[2*MAX];   int k=0;
  
  for(int i=0;i&lt;MAX;i++)
  { str3[k]=str1[i];  k++;    }
  for(int j=0;j&lt;MAX;j++)
  { str3[k]=str2[j];  k++;    }
  
  str3[k]='\0';
  cout&lt;&lt;endl&lt;&lt;"Here is the concatenated string:\n";
  cout&lt;&lt;str3&lt;&lt;endl;
  </code></pre>