第十八章 7 string型字符串的拷贝

// 7 string型字符串的拷贝

/*

#include <iostream>

#include <string>

using namespace std;

int main()

{

	//char ch1[15] = "hello word";

	//char ch2[] = "xiang ling chuan";

	//cout<<"源字符串"<<ch1<<endl;

	//memmove(ch1,ch2,5);

	//cout<<"拷贝后:"<<ch1<<endl;

    

	string str1="hello word";

	//string str2="xiang ling chuan";

	char str2[] = "xiang ling chuan";

	cout<<"源字符串"<<str1<<endl;

	int n = str1.copy(str2,11,0);

	cout<<"拷贝了"<<n<<"字符。"<<endl;

	cout<<"拷贝后:"<<str1<<endl;

	return 0;

}*/

  

你可能感兴趣的:(String)