- 博客(11)
- 资源 (5)
- 收藏
- 关注
原创 (1461)转换字符串为字符+字符连续出现的次数
#include #include #include using namespace std;int main(int argc, char *argv[]){ cout<<"input the numbers"<<endl; string str; getline(cin,str); char res[50]; res[0]='\0'; i
2012-03-20 17:54:12 528
原创 (1451)求一个字符串中连续出现次数最多的子串
#include #include #include #include using namespace std;pair fun(const string& str){ vector substrs;//存放所有子串 int maxcount=1,count=1; string substr; int i,len=str.length(
2012-03-20 17:26:51 994
原创 (1452)找出字符串中出现的相同的且长度最长的字符串,输出它及其首字母的位置
#include #include #include using namespace std;/*yyabcdabjcabceg输出:abc 3*/int main(int argc, char *argv[]){ string str,tep; cout<<"请输入字符串"<<endl; cin>>str; for(int i=str.length(
2012-03-20 17:25:24 1624
原创 (1453)重写strstr()函数,返回为主串中字符子串的位置以后的所有字符
#include #include /*重写strstr()函数,返回为主串中字符子串的位置以后的所有字符*/using namespace std;const char* strstr1(const char* string,const char * strCharSet){ for(int i=0;string[i]!='\0';i++) {
2012-03-20 17:23:36 1604
原创 (1454)将一句话中的单词倒置,标点符号不倒置。
#include #include #include /*句子中单词倒置,标点不倒置*/using namespace std;void reverse(char *str){ cout<<str<<endl; char *a=str; char temp; int i=0,j=0; int begin=0,end=0; //
2012-03-20 17:22:30 2408
原创 (1423)编写函数实现字符串循环右移n位
#include #include #include #define MAXLEN 20/*编写循环函数,使一个字符串循环右移n个字符*/using namespace std;void LoopMove1(char *str,int n){ char *p=str; char temp[MAXLEN]; int len=strlen(str);
2012-03-15 22:01:39 2895
原创 (1411)实现字符串与整数的相互转换(不使用itoa和atoi)
#include #include #include using namespace std;char *inttostring(int num,char *str)//整数转成字符串 { int i=0; char temp[10]; while(num!=0) { str[i]=num%10+'0';
2012-03-15 16:41:45 780
原创 c++ 两个栈实现队列
#include #include #include /*两个栈实现队列*/using namespace std;templatestruct MyQueue{ void push(T &t) { s1.push(t); } T front() { if(s
2012-03-14 09:31:22 915
原创 循环链表实现约瑟夫环
#include #include #include #define ERROR 0using namespace std;typedef struct LNode{ int data; struct LNode *link;}LNode,*LinkList;void Josephus(int n,int k,int m){ //n
2012-03-13 22:23:31 856
原创 c++ 实现双链表基本操作
#include #include #include #include /*c++实现双链表的基本操作*/using namespace std;typedef struct student{ int data; struct student *pre; struct student *next;}dnode;//创立链表 dn
2012-03-13 21:02:57 5161
原创 c++ 单链表基本操作
#include #include #include #include #include /*c++实现简单的单链表操作*/using namespace std;typedef struct student{ int data; struct student *next;}node;//建立单链表 node *creat(){ n
2012-03-13 21:01:44 29464 1
2016-2018年软件设计师真题及答案解析.zip
2020-03-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人