自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 收藏
  • 关注

原创 strcpy

char *strcpy(char *strDest, const char *strSrc) { assert((strDest != NULL) && (strSrc != NULL)); char *address = strDest; while( (*strDest++ = *strSrc++) != '\0' ) NULL; return address; }

2012-09-08 19:13:34 327

原创 整数转化成字符串,字符串转化成整数

//整数转化成字符串 #include #include int main(void) { int num = 12345, j = 0, i = 0; char temp[7], str[7]; //itoa(number, string, 10); while(num) { temp[i] = num % 10 + '0'; i++; num

2012-09-08 17:06:11 1245

原创 用两个栈实现一个队列的功能

#include #include using namespace std; template struct MyQueue { void push(T &t) { s1.push(t); } T front() { if(s2.empty()) { if(s1.size() == 0) throw; while(!s1.empty())

2012-09-05 09:05:37 429

原创 入栈与出栈

#include #include #include #include using namespace std; typedef struct student { int data; struct student *next; }node; typedef struct linkqueue { node *first, *rear; }qu

2012-09-05 08:36:51 540

原创 约瑟夫环

#include #include #include #define ERROR 0 typedef struct LNode { int data; struct LNode *link; }LNode, *LinkList; void JOSEPHUS(int n, int k, int m) { /*p为当前节点,r为辅助节点, 指向p的

2012-09-04 16:29:08 451

原创 双链表删除/插入节点

//双链表删除节点 dnode *del( dnode *head, int num ) { dnode *p1, *p2; p1 = head; while( num != p1->data && p1->next != NULL ) { p1 = p1->next; } if( num == p1->data ) { if(p1 == head) { head = h

2012-09-04 14:12:23 1698

原创 双链表的建立

//双链表 typedef struct student { int data; struct student *next; struct student *pre; }dnode; //建立双链表 dnode *creat() { dnode *head, *p, *s; int x, cycle = 1; head = (dnode*)malloc(sizeof

2012-09-03 13:50:21 1567

原创 单链表的逆置

node *reverse( *head ) { node *p1, *p2, *p3; if( head == NULL || head->next == NULL ) return head; p1 = head, p2 = p1->next; while(p2) { p3 = p2->next; p2->next = p1; p1 = p2; p2 = p3;

2012-09-01 16:21:44 414

原创 单链表建立 测长 打印

#include #include #include #include using namespace std; typedef struct student { int data; struct student *next; }node; node *creat() { node *head, *p, *s; int x, cycle =

2012-08-31 11:18:55 488

原创 覆盖和重载

覆盖,是指子类重新定义父类的虚函数的做法。 重载,是指允许存在多个同名函数,而这些函数的参数表不同(或许参数个数不同,或许参数类型不同,或许两者都不同)。 对于重载函数的调用,在编译期间就已经确定了,是静态的。也就是说它们的地址在编译期间就绑定了(早绑定),因此重载和多态无关。 真正与多态相关的是“覆盖”。当子类重新定义了父类的虚函数后,父类指针根据赋给它的不同的子类指针,动态地调用

2012-08-24 15:16:53 338

原创 String类

class String { public: //普通构造函数 String( const char *str = NULL ); //拷贝构造函数 String( const String &other ); //析构函数 ~String( void ); //赋值函数 String & operate =( const String &other ); private:

2012-08-24 13:08:10 351

原创 链表的基本实现例程

#ifndef _List_H struct Node; typedef struct Node *PtrToNode; typedef PtrToNode List;// why is it typedef PtrToNode Position; List MakeEmpty( List L ); int Islast( Position P, List L );

2012-08-23 15:15:17 471

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除