Advertisement
nastiia_firefly

Untitled

Dec 2nd, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. TString s1_input_s2( TString &s1,  TString &s2)
  2. {
  3.     TString buff;
  4.     int sz = strlen(s1.str) + strlen(s2.str)-2;
  5.     buff = new char[sz + 1];
  6.     buff.str[0]=sz;
  7.     int poz=2;
  8.     int i=0;
  9.     int j=0;
  10.  
  11.     for( i = 1,j=0; i <poz,j<strlen(s1.str); i++,j++)
  12.         {buff.str[i] = s1.str[i];buff.output();}
  13.  
  14.      for(i=poz,j=1;i<=strlen(s2.str),j<=strlen(s2.str);i++,j++)
  15.         {buff.str[i] = s2.str[j];buff.output();}
  16.  
  17.      for(i=strlen(s2.str)+poz,j=poz+1;i<strlen(s1.str),j<strlen(s1.str)+poz;i++,j++)
  18.         {buff.str[i]=s1.str[j];buff.output();}
  19.  
  20.  
  21. return buff;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement