P5734 【深基6.例6】文字处理软件 洛谷

本文介绍了C++中用于字符串操作的四个关键函数:append用于追加字符串,substr用于提取子字符串,insert用于在指定位置插入字符串,find用于查找子字符串出现的位置。并通过示例代码展示了这些函数的用法。

题目链接:https://www.luogu.com.cn/problem/P5734

思路:

        运用C++的四个函数就好了

        ①append函数,在原字符串后添加字符串

                官方介绍:https://cplusplus.com/reference/string/string/append/

                这是官方给的例子:

// appending to string
#include <iostream>
#include <string>

int main ()
{
  std::string str;
  std::string str2="Writing ";
  std::string str3="print 10 and then 5 more";

  // used in the same order as described above:
  str.append(str2);                
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值