C++函数string

cpp 复制代码
#include<bits/stdc++.h>
using namespace std;
void f(int);
int n;
int main()
{
	system("color 1");
	string a,b;
	int s=1;
	cin>>a;
	int la=a.size();
	for(int i=la;i>=1;i--){
		b[s]=a[i];
		s++;
	}
	if(b.find("re")==1||b.find("yl")==1){
		b.erase(1,2);
	}
	else if(b.find("gni")==1){
		b.erase(1,3);
	}
	reverse(b.begin(),b.end());
	cout<<b;
	return 0;
}
void f(int n){
	
	return;
}
cpp 复制代码
#include<bits/stdc++.h>
using namespace std;
void f(int);
int n;
int main()
{
	system("color 1");
	string a,b;
	getline(cin,a);
	cin>>b;
	int x=a.find(b);
	a.erase(x,b.size());
	cout<<a;
	return 0;
}
void f(int n){
	
	return;
}
cpp 复制代码
#include<bits/stdc++.h>
using namespace std;
void f(int);
int n;
int main()
{
	system("color 1");
	string a,b;
	getline(cin,a);
	cin>>b;
	int x;
	n=a.size();
	for(int i=1;i<=n;i++){
		x=a.find(b);
		a.erase(x,b.size());
	}
	cout<<a;
	return 0;
}
void f(int n){
	
	return;
}
cpp 复制代码
#include<bits/stdc++.h>
using namespace std;
void f(int);
int n;
int main()
{
	system("color 1");
	string a,b;
	getline(cin,a);
	cin>>b;
	int x;
	n=a.size();
	for(int i=1;i<=n;i++){
		x=a.find(b);
		a.replace(x,b.size(),a);
	}
	cout<<a;
	return 0;
}
void f(int n){
	
	return;
}
相关推荐
c1s2d3n4cs5 小时前
Qt模仿nlohmann::json进行序列化和反序列化
开发语言·qt·json
AiTop1006 小时前
Claude Code 推出 Agent View:命令行编程正式进入“多线程并发“时代
开发语言·人工智能·ai·aigc
jf加菲猫6 小时前
第21章 Qt WebEngine
开发语言·c++·qt·ui
码农-阿杰6 小时前
深入理解 synchronized 底层实现:从 HotSpot C++ 源码看对象锁与 Monitor 机制
开发语言·c++·
2401_832298107 小时前
AI智能体监管落地,OpenClaw率先建立行业合规标准
开发语言
Szime7 小时前
深智微IC华润微代理:MCU选型与工业控制方案推荐
c++
geovindu7 小时前
go: Lock/Mutex Pattern
开发语言·后端·设计模式·golang·互斥锁模式
知识分享小能手7 小时前
R语言入门学习教程,从入门到精通,R语言日期和时间序列(6)
开发语言·学习·r语言
叼烟扛炮7 小时前
C++ 知识点18 内部类
开发语言·c++·算法·内部类
汉克老师7 小时前
GESP5级C++考试语法知识(十五、分治算法(二))
c++·算法·排序算法·分治算法·gesp5级·gesp五级