Hello,
this is my yet another problem i have made 1 user defined function which works pretty much like strstr function defined in string.h but it's having problem. I have figured out the problem but don't know how to solve it. Here is the code! Please have a look and tell me how to solve it?
Just give input as iliketechnology it works fine and then give ilikettechnology!Code:#include <iostream.h> char* ustrstr(char s[],char t[]) { int i,j; char *temp; for(i=0;s[i]!=NULL;i++) { j=0; temp=&s[i]; while(t[j]==s[i] && s[i]!=NULL) { j++; i++; } if(t[j]==NULL) return temp; if(s[i]==NULL) i--; } return NULL; } int main(void) { char s[100],*j; cout<<"\n\nEnter Any String :"; cin.getline(s,100); j=ustrstr(s,"technology"); if(j==NULL) cout<<"\n\nSubstring Not Found"; else cout<<"\n\nSubstring Found :"<<j; return 0; }it's not working i know where the problem is but dont know how to solve. Please help me



LinkBack URL
About LinkBacks
it's not working i know where the problem is but dont know how to solve. Please help me 




what does this mean elysia??we need to check the pstring[i] with pfind[j]
so what's the worry in that?
CornedBee