![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串
数据结构与算法之字符串
米兰的枫
这个作者很懒,什么都没留下…
展开
-
字符串循环右移
方法一:字符串遍历移动#include <iostream>#include <string>using namespace std;int main(){ string str; char temp; int n;//向右移动n位 cin >> str; cin >> n; int len = str.size(); for(int i = 0; i < n; i++)//每一轮向右原创 2021-09-13 11:51:14 · 484 阅读 · 0 评论 -
数字字符串的分割
必看:C语言strtok()分割函数详解#include <iostream>#include <string>#include <vector>#include <stdio.h> //sscanf()在C语言中包含在此头文件中#include <string.h> //strtok()在C语言中包含在此头文件中using namespace std;int main(){ string str; cout&原创 2021-09-09 10:59:28 · 1101 阅读 · 0 评论 -
字符串排序
给定n个字符串,请对n个字符串按照字典序排列。输入描述:输入第一行为一个正整数n(1≤n≤1000),下面n行为n个字符串(字符串长度≤100),字符串中只含有大小写字母。#include <iostream>#include <string>#include <vector>#include <algorithm>using namespace std;int main(){ int n; while(cin >>原创 2021-09-09 09:59:53 · 96 阅读 · 0 评论