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;
}
相关推荐
程与留13 小时前
15_国际化和本地化:tr()、ts 文件、QM 文件、多语言切换
c++·qt
程与留15 小时前
14_Qt 样式表(QSS)入门(语法、选择器、美化实战)
c++·qt
欧特克_Glodon1 天前
OpenCV计算机视觉开发入门与实践<二十七>:图像分割概述
c++·人工智能·opencv·计算机视觉
蒸蒸yyyyzwd1 天前
cpp 选手秋招学习笔记 day21
c++·面试·八股
Interview Aid1121 天前
TikTok OA 四题分享|半小时内 AC,题目基本都是实现题
java·开发语言·算法·面试·职场和发展
CoderIsArt1 天前
C#中UI 线程与 Dispatcher
开发语言·ui·c#
AI情绪识别开源1 天前
检信 ALLEMOTION OS 加密打包可执行程序 — 全面测试报告版本: v1.3功能测试 / 性能测试 /
开发语言·数据结构·人工智能·功能测试
「QT(C++)开发工程师」1 天前
C++ auto 用法详解
开发语言·c++
OPEN-F1 天前
C++STL教程:容器适配器与实用工具
开发语言·c++