189_string容器-构造函数

在这里插入图片描述
在这里插入图片描述


#include <iostream>
#include <string>

using namespace std;

void test01()
{
    
    
	string s1;
	const char* str = "hello world";
	string s2(str);
	cout << "s2=" << s2 << endl;

	string s3(10, 'a');
	cout << "s3=" << s3 << endl;
}

int main()
{
    
    
	test01();
	return 0;
}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42990464/article/details/124493811