上一页 1 ··· 57 58 59 60 61 62 63 64 65 ··· 99 下一页

2011年6月8日

不带参的构造函数

摘要: #include<iostream>#include<string>using namespace std;/*类并不是一个实体,而是一种投象数据类型,并不占存储空间,显然无处容纳。*//*对像的初始化,构造函数,与类名相同*/class Time{ public : //构造函数,功能由自己定义 Time( ) { hour=0; minute=0; sec=0; } void set(); ... 阅读全文

posted @ 2011-06-08 22:25 more think, more gains 阅读(391) 评论(0) 推荐(0) 编辑

类的封装性与隐敝性

摘要: 1.类声明和成员函数的分离 在一个工程里面,头文件包含类的声明。另一个文件定义类成员函数。 最后还有一个主函数的文件。 //student.cpp,类成员函数的定义 #include<iostream>#include"student.h"using namespace std;void student::display( ){ cout<<num<<endl; cout<<name<<end... 阅读全文

posted @ 2011-06-08 22:03 more think, more gains 阅读(348) 评论(0) 推荐(0) 编辑

c++ 类的学习2

摘要: #include<iostream>#include<stdlib.h>#include<string>using namespace std;class Time{ public: void set_time(); //公有成员函数,声明函数 void show_time();//公有成员函数,声明函数 private: int hour; int minute; int sec;};int m... 阅读全文

posted @ 2011-06-08 21:40 more think, more gains 阅读(160) 评论(0) 推荐(0) 编辑

c++类的学习

摘要: #include<iostream>#include<stdlib.h>#include<string>#include<time.h>using namespace std;class Array{ public: void set(); void show(); void find(); void allshow(); private: int max; int array[1000];};v... 阅读全文

posted @ 2011-06-08 21:39 more think, more gains 阅读(188) 评论(0) 推荐(0) 编辑

2011年5月15日

qsort/sort

摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>#include<algorithm>using namespace std;int cmp1(const void *a,const void *b){ return *(int *)a<*(int *)b?1:-1;}int cmp2(const void *a,const void *b... 阅读全文

posted @ 2011-05-15 12:51 more think, more gains 阅读(175) 评论(0) 推荐(0) 编辑

上一页 1 ··· 57 58 59 60 61 62 63 64 65 ··· 99 下一页

导航