![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
灯红酒绿i
想要一直有幸运相伴,所以只能努力!
展开
-
判断一个字符串是否为回文
判断一个字符串是否为回文,即从前往后读和从后往前读都是同一个字符串。 //判断字符串是否是回文 #include<iostream> #include<string.h> using namespace std; bool IsPalindrome(const char *s,int n) { //非法输入 if(s==NULL||n<1) ...原创 2018-09-09 21:19:36 · 1499 阅读 · 0 评论 -
求字符串中字符出现个数
//设计一个算法,计算一个顺序穿s中每个字符出现的次数 #include<iostream> using namespace std; const int MaxSize = 100; class SqStringClass { char *data; //存放串中的元素 int length; //串中的字符的个数 public: SqStringClass(); //构造函数...原创 2018-11-05 11:42:53 · 901 阅读 · 0 评论 -
将字符串中abc删除
//设计一个算法,将一个链串s中的所有子串“abc”删除 #include<iostream> using namespace std; struct LinkNode //链串结点指针 { char data; //存放一个字符 LinkNode *next; //指向下一个结点的指针 }; class LinkStringClass //链串类 { LinkNode *h...原创 2018-11-05 11:44:12 · 875 阅读 · 0 评论 -
判断字符串是否是递增排列
//设计一个算法,判断链串s中的所有元素是否为递增排列的 #include<iostream> using namespace std; struct LinkNode { char data; //存放一个字符 LinkNode *next; //指向下一个结点的指针 }; class LinkStringClass { LinkNode *head; //链串头结点指针 ...原创 2018-11-05 11:46:00 · 2277 阅读 · 0 评论 -
vector的使用
vector的使用 #include<iostream> #include<vector> #include<algorithm> using namespace std; bool Comp(const int &a,const int &b) { if(a!=b) return a>b; else return a>b; ...原创 2019-03-03 15:16:34 · 87 阅读 · 0 评论 -
string 的使用
#include #include #include using namespace std; int main() { /*string s=“abc”; cout<<s.length()<<endl; s=s+‘a’; cout<<s<<endl; s=s+“123”; cout<<s<<endl; s.append(“2...原创 2019-03-03 15:54:59 · 96 阅读 · 0 评论 -
栈和队列
#include #include #include using namespace std; int main() { /----栈—先进后出------/ /* stacks; //建栈 s.push(1); //进栈 s.push(2); s.push(3); s.push(9); cout<<s.top()<<endl; //获取栈顶元素 cout<<...原创 2019-03-03 16:48:21 · 88 阅读 · 0 评论