string insert(string &s1,string &s2,int n)
{
string tem(s1.begin(),s1.begin()+n);
string tem1(s1.begin()+n,s1.end());
tem+=s2;
return tem+tem1;
}
int _tmain(int argc, _TCHAR* argv[])
{
string s="abcdefg";
string s1="ab";
string result=insert(s,s1,3);
cout<<result<<endl;
return 0;
}
posted on 2012-05-18 15:55
qiushao 阅读(518)
评论(0) 编辑 收藏 引用