C++stringクラスassignの使い方

387 ワード

#include <string>



#include <iostream>

using namespace std;





int main()

{

string str1c ( "Hello " ), str2c ( "WideeWorld" );

str1c.assign ( str2c , 5 , 3 );// str2c     5     3    str1;

cout<<str2c<<endl;//     WideeWorld

cout<<str1c<<endl;//     Wor





system("pause");

}