#include<iostream> #include<cstdio> #include<cstring> using namespace std; void strstr(int &a, int &b); void strstr(char *str, char *buf); int main() { setlocale(LC_ALL,"Russian"); char s1[80]="Hellow word"; char s2[80]="word"; int i,j; cout<<"Введите два числа: "; cin>>i>>j; strstr(i,j);//Cравнение двух чисел //теперь рассмотрим поиск подстроки в строке strstr(s1,s2); return 0; } void strstr(int &a, int &b) { if(a>b) cout<<"Первое число больше второго"; else cout<<"Второе число больше первого"; cout<<endl; } void strstr(char *str, char *buf) { char *p; char *q; for(int i=0; str[i]; i++) { p=&str[i]; q=buf; while(*q && *q==*p) { p++; q++; } } cout<<q; }