上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页

2014年5月20日

友元

摘要: 我们已知道类具备封装和信息隐 藏的特性。只有类的成员函数才能访问类的私有成员,程式中的其他函数是无法访问私有成员的。非成员函数能够访问类中的公有成员,但是假如将数据成员都定义 为公有的,这又破坏了隐藏的特性。另外,应该看到在某些情况下,特别是在对某些成员函数多次调用时,由于参数传递,类型检查和安全性... 阅读全文

posted @ 2014-05-20 14:30 berkeleysong 阅读(100) 评论(0) 推荐(0) 编辑

C++ static成员

摘要: 类中的静态成员真是个让人爱恨交加的特性。我决定好好总结一下静态类成员的知识点,以便自己在以后面试中,在此类问题上不在被动。静态类成员包括静态数据成员和静态函数成员两部分。一 静态数据成员:类体中的数据成员的声明前加上static关键字,该数据成员就成为了该类的静态数据成员。和其他数据成员一样,静态数... 阅读全文

posted @ 2014-05-20 14:24 berkeleysong 阅读(93) 评论(0) 推荐(0) 编辑

C++杂分析

摘要: class word{public: word(){cout#includeusing namespace std;class Text{public: static const int a = 1; ///static 数据成员独立与该类存在 ///static int b = ... 阅读全文

posted @ 2014-05-20 14:22 berkeleysong 阅读(133) 评论(0) 推荐(0) 编辑

2014年5月19日

求链表的中心节点

摘要: #includeusing namespace std;class node{public: node():value(0),next(NULL){} ~node(){} int value; node* next;};///be careful this ;node* cr... 阅读全文

posted @ 2014-05-19 19:57 berkeleysong 阅读(170) 评论(0) 推荐(0) 编辑

链表的递归运算

摘要: #includeusing namespace std;class node{public: node():value(0),next(NULL){} ~node(){} int value; node* next;};///be careful this ;node* cr... 阅读全文

posted @ 2014-05-19 19:43 berkeleysong 阅读(174) 评论(0) 推荐(0) 编辑

逆序链表

摘要: #includeusing namespace std;class node{public: node():value(0),next(NULL){} ~node(){} int value; node* next;};///be careful this ;node* cr... 阅读全文

posted @ 2014-05-19 19:34 berkeleysong 阅读(175) 评论(0) 推荐(0) 编辑

找到链表的倒数第K位

摘要: #includeusing namespace std;class node{public: node():value(0),next(NULL){} ~node(){} int value; node* next;};///be careful this ;node* cr... 阅读全文

posted @ 2014-05-19 16:32 berkeleysong 阅读(175) 评论(0) 推荐(0) 编辑

链表的增删(未考虑末尾)

摘要: #includeusing namespace std;class node{public: node():value(0),next(NULL){} ~node(){} int value; node* next;};///be careful this ;node* cr... 阅读全文

posted @ 2014-05-19 16:21 berkeleysong 阅读(188) 评论(0) 推荐(0) 编辑

计算出前N项的数据

摘要: #include#include#includeusing namespace std;const int N = 10;int helper(int* a,const int num1,const int num2){ int i=1; int j=1; for(int m = 0;m te... 阅读全文

posted @ 2014-05-19 11:52 berkeleysong 阅读(113) 评论(0) 推荐(0) 编辑

将后面的m个数移到前面

摘要: #include#include#include#includeusing namespace std;int bigswap(char* a,int start,int end){ while(start<end) { swap(a[start],a[end]); ... 阅读全文

posted @ 2014-05-19 11:34 berkeleysong 阅读(201) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页

导航