Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #define MAX 80
  4. int ondeEsta(char frase1[], char frase2[])
  5. {
  6. int i,j,count=0,n=0;
  7.  
  8. for(i=0;i<strlen(frase1);i++)
  9. { if(frase1[i]==frase2[0]){
  10. for(j=0;j<strlen(frase2);j++)
  11. {
  12. if(frase1[i] == frase2[j])
  13. {
  14. count++;
  15. if(strlen(frase2) == count)
  16. {
  17. return i-count;
  18. }
  19. i++;
  20. n++;
  21. }
  22. else count =0;i=i-n+1;break;
  23. }}
  24. }
  25. return -1;
  26. }
  27. int main(void)
  28. {
  29. char frase1[MAX],frase2[MAX];
  30.  
  31. gets(frase1);
  32. gets(frase2);
  33.  
  34. printf("%d\n",ondeEsta(frase1,frase2));
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement