#include <iostream>
#include <string.h>
using namespace std;
int main()
{
string result;
string s ( "AAAAAAAA" );
char ch = 'C';
result = s.replace ( 1 , 3 , 4 , ch ); // s= "ACCCCAAAA
cout<<s<<endl;
return 0;
}
转载于:https://www.cnblogs.com/byfei/archive/2012/05/11/3112261.html