container-string-构造

2019-08-29  本文已影响0人  人不知QAQ

#include<iostream>

using namespace std;

#include <string>

void  test01()

{

string s1;//默认构造

const char* str = "hellworld!";

string s2(str);

cout << "s2= " << s2 << endl;

string s3(str);

cout << "s3= " << s3 << endl;//拷贝构造

string s4(10, 'q');

cout << "s4= " << s4 << endl;//拷贝构造

}

int main()

{

test01();

system("pause");

return 0;

}

上一篇 下一篇

猜你喜欢

热点阅读