#include <iostream>
#include <vector>
#include <string>
using namespace std;
void fun_940()
{
string q1("When lilacs last in the dooryard bloom'd");
string q2("The child is father of the man");
string sentence;
sentence.assign(q2, 0, 12);
sentence.append(q1, 16, 16);
cout<<sentence<<endl;
}《c++ Primer(第四版)》习题 9.40
最新推荐文章于 2024-04-15 20:25:45 发布
本文展示了一个使用C++进行字符串拼接和截取的例子。通过这个简单的程序,读者可以了解如何利用C++标准库中的string类来实现字符串的复制、截取及连接等基本操作。
》习题 9.40&spm=1001.2101.3001.5002&articleId=25248861&d=1&t=3&u=b9220d7f3ca64a5a8f2d4a853bf165ab)
464

被折叠的 条评论
为什么被折叠?



