#include <iostream> #include <string> using namespace std; int main() { //char ch1[10] = "gh"; //char ch2[] = "abcdef"; //strncpy(ch1,ch2,6); //cout<<ch1<<endl; string str1="hello word"; //string str2="xianglingchuan"; //支持char字符串 //char str2[] = "xianglingchuan"; //支持char型字符 char str2='a'; str1.replace(0,2,2,str2); cout<<str1<<endl; return 0; }