回复 4楼 rjsp
											#include<iostream>
#include<string>
#include<cstring>
using namespace std;
const m=100;
const n=50;
int stringmatch(char ch1[],char ch2[])
{
    int i,j,l;
    for(l=0;ch2[l]!=0;l++);//获取被比较字符串长度
    for(i=0;ch1[i]!=0;i++)
    {
        for(j=0;ch1[i+j]==ch2[j]&&ch2[j]!=0;j++);
        if(j==l)
           return 1;
    }
    return 0;
}
void main()
{
    int k;
    char c1[n];
    char c2[m];
    cout<<"请输入第一串字符:"<<endl;
    cin.getline(c1,n-1);
    cout<<"第一串字符为:"<<c1<<endl;
    cout<<"请输入第二串字符:"<<endl;
    cin.getline(c2,m-1);
    cout<<"第二串字符为:"<<c2<<endl;
    k=stringmatch(c1,c2);
    if(k!=0)
        cout<<"匹配成功,且开始匹配为:"<<k<<endl;
    else
        cout<<"匹配失败"<<endl;
}