
数据结构
文章平均质量分 63
syc0616
这个作者很懒,什么都没留下…
展开
-
单链表
//单链表#ifndef _LINKLIST_H_#define _LINKLIST_H_typedef struct LinkList{ int data; LinkList *next; int length;}node;node* Create();int length(node* H);node* Del(node *H,int num);#endif #include原创 2010-03-03 15:45:00 · 478 阅读 · 0 评论 -
双链表
typedef struct DoubleLink{ int data; DoubleLink *next; DoubleLink *pre; int length;}Dnode;Dnode *Create();Dnode * Del(Dnode * H,int num); #include #include #include "DoubleLink.h"using namesp原创 2010-03-03 15:47:00 · 443 阅读 · 0 评论 -
整数和字符串之间转换
#include using namespace std;////思想是一个整数加上0自动变成字符型,注意然后要输出void main(){ int num = 12345; int i = 0,j = 0; char temp[6],str[6],string[6]; itoa(num,string,10); //string[5] = 0; printf("num =原创 2010-03-04 11:12:00 · 583 阅读 · 0 评论 -
字符串右移
#include using namespace std;void LoopMove(char *pStr,int step){ int n = strlen(pStr)-step; char *p = pStr+n; char temp[20] = {0}; printf("pStr+n = %c/n",*(pStr+n)); strcpy(temp,pStr+n); strcpy(tem原创 2010-03-04 12:26:00 · 651 阅读 · 0 评论 -
自己写的整数和字符串之间的转化
//conver int to char#include #include #include void IntToChar(int num);int CharToInt(char *p);void main(){ int num=123456; IntToChar(num); char *string = new char[7]; string="123456"; int原创 2010-03-04 13:51:00 · 511 阅读 · 0 评论 -
strstr函数
////返回包括子串的整个字符串 #include#include#includeusing namespace std;const char* strstr1(const char *s,const char* str){ for(int i =0;s[i]!=/0;i++) { int j = 0; if(s[i]==str[j]) { while(s[i+原创 2010-03-04 14:33:00 · 517 阅读 · 0 评论 -
字符串逆置
#include #include using namespace std;void main(){ int i,j,begin,end; char temp; char str[] = "i come form helongjiang."; i = 0; j = strlen(str)-1; //因为数组从0开始,所以减1 printf("str = %s/n",str); //1 先整原创 2010-03-04 14:23:00 · 651 阅读 · 0 评论