摘要: #include <iostream>#include <string.h>using namespace std;float add(float m,float n){return m+n;}float dec(float i,float j){return i-j;}int main(){float (*p)(float,float);float a,b;char c;cin>>a>>c>>b;switch(c){case '+':p = add;break;case '-':p = dec;bre 阅读全文
posted @ 2011-12-03 23:12 rookieeeeee 阅读(96) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string.h>using namespace std;char b[80];char *result = b;char *convert(char *p1){// char *result;// char b[80];// result = b;unsigned short temp = strlen(p1);unsigned short i = temp - 1;p1 += i;for(int j = temp;j > 0; j--){*result++ = *p1--;}*result +=  阅读全文
posted @ 2011-12-03 22:46 rookieeeeee 阅读(146) 评论(0) 推荐(0) 编辑
摘要: //越来越强啦 ^-^#include <iostream>#include <string.h>using namespace std;int findAlpha(char *p1,char *p2){unsigned short n1 = strlen(p1);unsigned short n2 = strlen(p2);int i,j;for (i = 0; i < n1; i++){unsigned short flag = i;for (j = 0;j < n2; j++){if (p1[flag] == p2[j]){flag++;if (j = 阅读全文
posted @ 2011-12-03 21:24 rookieeeeee 阅读(134) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string.h>using namespace std;// void swap(int *p1,int *p2)// {// int temp;// temp = *p1;// *p1 = *p2;// *p2 = temp;// }void swap(int &p1,int &p2){int temp;temp = p1;p1 = p2;p2 = temp;}int main(){int a = 1,b = 2;/*swap(&a,&b);*/swap(a,b);cout&l 阅读全文
posted @ 2011-12-03 20:45 rookieeeeee 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 指针方式:#include <iostream>#include <string.h>using namespace std;void fun(char *aa){int num = strlen(aa);char b[5];for(int i = 0; i < num+1; i++){b[i] = aa[i];}cout<<strlen(aa)<<endl<<sizeof(aa)<<endl<<sizeof(*aa)<<endl;/*b[4] = '\0';*/cout< 阅读全文
posted @ 2011-12-03 14:53 rookieeeeee 阅读(188) 评论(0) 推荐(0) 编辑
摘要: http://baike.baidu.com/view/1391603.htm 智能指针Smart Pointer编辑本段智能指针的原理及实现 当类中有指针成员时,一般有两种方式来管理指针成员:一是采用值型的方式管理,每个类对象都保留一份指针指向的对象的拷贝;另一种更优雅的方式是使用智能指针,从而实现指针指向的对象的共享。 智能指针(smart pointer)的一种通用实现技术是使用引用计数(reference count)。智能指针类将一个计数器与类指向的对象相关联,引用计数跟踪该类有多少个对象共享同一指针。 每次创建类的新对象时,初始化指针并将引用计数置为1;当对象作为另一对象的副... 阅读全文
posted @ 2011-11-29 16:20 rookieeeeee 阅读(266) 评论(0) 推荐(0) 编辑
摘要: [C++再学习系列] 隐式类型转换与转换操作符operator T分类: C++再学习系列 2009-07-05 21:26 217人阅读 评论(0) 收藏 举报http://blog.csdn.net/zhenjing/article/details/4323615http://topic.csdn.net/t/20050301/13/3815012.html //good discusion!隐式类型转换与转换操作符 operator TC++ 标准允许隐式类型转换,即对特定的类,在特定条件下,某些参数或变量将隐形转换成类对象 ( 创建临时对象 ) 。如果这种转换代价很大 ( 调用类的构造 阅读全文
posted @ 2011-11-29 11:55 rookieeeeee 阅读(2774) 评论(0) 推荐(0) 编辑
摘要: C++模板使用介绍http://www.kuqin.com/language/20090405/44193.html 来源:C++博客 2009-04-05分享到: 新浪微博 腾讯微博 豆瓣网 人人网 开心网 QQ空间 搜狐微博 更多 8-1. 模板的概念。我们已经学过重载(Overloading),对重载函数而言,C++的检查机制能通过函数参数的不同及所属类的不同。正确的调用重载函数。例如,为求两个数的最大值,我们定义MAX()函数需要对不同的数据类型分别定义不同重载(Overload)版本。//函数1.int max(int x,int y);{return(x>y)?x:y ;}/ 阅读全文
posted @ 2011-11-29 00:08 rookieeeeee 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 我学习CRC32、CRC16、CRC原理和算法的总结(与WINRAR结果一致)发布时间:2010-09-02 11:26:15 整理好的PDF可以在BAIDU免费下载:http://wenku.baidu.com/view/fb791c0203d8ce2f006623f5.htmlhttp://bbs.ednchina.com/BLOG_ARTICLE_1828885.HTM我学习CRC32、CRC16、CRC原理和算法的总结(与WINRAR结果一致)wxleasyland(wxlwww@gmail.com)2010年9月2日比较愚钝,学了CRC校验好几天,很痛苦的过程,现终于有眉目了,总结. 阅读全文
posted @ 2011-11-28 19:31 rookieeeeee 阅读(14941) 评论(2) 推荐(3) 编辑
摘要: #include <iostream>using namespace std;int main(){int a[4] = {0,1,2,3};int (*p)[4];p = &a;for (int i = 0;i <= 3;){cout<<(*p)[i++]<<endl;} //数组指针 //int *pi[4];int b[4];int *pi[4]={&b[0],&b[1],&b[2],&b[3]};for (int j = 0; j <= 3;j++){*pi[j] = j;}for (int k = 阅读全文
posted @ 2011-11-27 22:15 rookieeeeee 阅读(203) 评论(0) 推荐(0) 编辑