- English
- فارسی
27-1
#include<iostream.h> #include<stdio.h> char *myStrStr(const char *s1, const char *s2) { for (; *s1 ; s1++) { // avvale jaayi ke donbaale s2 migardim char *tempS1 = (char *)s1; char *tempS2 = (char *)s2; while (*tempS2) { if (*tempS1!=*tempS2) break; tempS1++; tempS2++; } if (*tempS2 == 0) return (char *)s1; } } void main () { char matn[1024]="mohalreza aaabaaaa va aaaa mahmood be alireza salam kardand\ lili"; char str[80] = "ali"; myStrStr(matn, str); }