Problems !!

Nov 25, 2008 at 3:17pm
Hey, i would like to compare two strings and match it up like this.

First string = popo
Second String = Hi there

It will become like this.
Hi there
po popop.

it like skipping the space and go to the next one. Help anyone?
Nov 25, 2008 at 3:20pm
Could you describe algorithm in greater detail?
Last edited on Nov 25, 2008 at 3:47pm
Nov 25, 2008 at 4:08pm
I think mrgoogle wants something like this:
1
2
3
4
5
6
7
8
for(int f=0,s=0; f<first.length(); f++, s++)
{
     if (s>=second.length()) s=0;
     if (first[f]==' ')
     {     s=-1;
           third+=' ';
     }else third+=second[s];
}
Topic archived. No new replies allowed.