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;
}
相关推荐
见过夏天4 小时前
C++ 基础入门完全指南
c++
用户805533698032 天前
不止三件套:QObject 属性系统全关键字与运行时反射!
c++·qt
BadBadBad__AK2 天前
线段树维护区间 k 次方和
c++·数学·算法·stl
卷无止境3 天前
Eigen 库如何借助 OpenMP 加速计算
c++·后端
卷无止境3 天前
OpenMPI、MPICH 与 OpenMP:关系、核心概念与架构全解
c++·后端
郝学胜_神的一滴3 天前
CMake 30:循环语法全解|foreach_while双循环精讲、迭代技巧与实战避坑指南
c++·cmake
卷无止境5 天前
C++ 的Eigen 库全解析
c++
卷无止境5 天前
现代 C++特性大盘点:一门脱胎换骨的老语言
c++·后端
郝学胜_神的一滴6 天前
CMake 27:缓存变量的特性、语法、类型与实操全解
c++·cmake
博客18007 天前
酷宝的使用方法,超好用的免费界面库,C++、MFC可用
c++·mfc·界面库·库来帮·酷宝