using strtok

plz help me for this. i was trying to find similar words from two sentences string1 and string2.but i having problem with using strtok and strcpy together.plz some one help me to do this.my program i have copy below :


char string1[81];
cout<< "please enter 1st line:";
for(int i=0; i<n1; i++)
{
cin>> string1[i];
}

char string2[81];
cout<< "please enter 2nd line:";
for(int j=0; j<n2; j++)
{
cin>> string2[j];
}

char seps[]= " ";
char words1[15][20];
char words2[15][20];
int i;
int j;
int count01;
int count02;

count01=0;
strcpy(words1[0],strtok (string1, seps)); //strcpy use karanna
while( words1[count01] !=NULL)
{
count01++;
strcpy(words1[count01],strtok(NULL, seps));
}


count02=0;
strcpy(words2[0],strtok (string2, seps));
while( words2[count02] !=NULL)
{
count01++;
strcpy(words2[count02],strtok(NULL, seps));
}
Topic archived. No new replies allowed.