9.6.2-2

    技术2025-08-07  10

    int main(){ char *p="abcdefg"; string s="hijkl"; //用p标记范围内的元素替换掉s s.assign (p,p+4); cout<<s<<endl;//abcd

     

     

     string s1="hello"; //将string的副本插入到另一个对象中 s.insert (s.begin()+4,s1.begin (),s1.end()); cout<<s<<endl;

     system ("pause");}

    最新回复(0)