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;
}
相关推荐
-银雾鸢尾-2 分钟前
两数之和-C++实现
c++·算法
j7~13 分钟前
【动态规划算法专题】动态规划五部曲实战:泰波那契数、三步问题、最小花费爬楼梯
c++·算法·动态规划·数据结构与算法
jimy113 分钟前
C++ 报错的 qualifiers 的意思
开发语言·c++
揽星河..1 小时前
【C++】类和对象
c++·算法
D e re k ZH1 小时前
C++ 并发、未定义行为与工程化难点(No 3)
数据结构·c++·算法·面试
不积跬步无以至千里mmbb262 小时前
rust_analysis
开发语言·后端·rust
暴力求解2 小时前
C++ ---继承(二)
开发语言·c++·算法
陈飞EXCEL3 小时前
北京杰飞 IT 旗下妙码生花少儿Python编程上线两大学习系统
开发语言·python·学习
代龙涛3 小时前
WordPress Query 查询机制详解(WP_Query)
开发语言·后端·php·wordpress
znsoft3 小时前
MaClaw(码卡龙)技术拆解:一个 Go + React 的可自进化智能体平台
开发语言·react.js·golang