- 博客(27)
- 资源 (24)
- 收藏
- 关注
原创 初始化列表的初始化变量顺序是根据成员变量的声明顺序来执行的
#include#includeusing namespace std;class base{private: int m_j; int m_i;public: base(int i):m_j(i),m_i(m_j) {} base():m_j(0),m_i(m_j) {} int get_i() {return m_i; } int get_j()
2013-06-02 23:51:15 730 1
原创 一个整数转化为二进制数后包含1的个数
int Func(int x){ int count=0; while(x!=0) { count++; x=x&(x-1); } return count;}int _tmain(int argc, _TCHAR* argv[]){ int x=9999;
2012-11-25 21:10:37 810
原创 人员信息管理(Ⅴ)
<br />//employee.h 类的定义<br />class employee<br />{<br />protected:<br /> char name[20];<br /> int individualEmpNo; //个人编号<br /> int grade; //级别<br /> float accumPay; //月薪<br /> static int employeeNo; //本公司职员编号目前最大值<br />public:<br />
2010-06-03 22:22:00 630
原创 人员信息管理(Ⅴ)
<br />//employee.h 类的定义<br />class employee<br />{<br />protected:<br /> char name[20];<br /> int individualEmpNo; //个人编号<br /> int grade; //级别<br /> float accumPay; //月薪<br /> static int employeeNo; //本公司职员编号目前最大值<br />public:<br />
2010-06-03 22:14:00 629
原创 人员信息管理(Ⅳ)
<br />//employee.h 类的定义<br />class employee<br />{<br />protected:<br /> char name[20];<br /> int individualEmpNo; //个人编号<br /> int grade; //级别<br /> float accumPay; //月薪<br /> static int employeeNo; //本公司职员编号目前最大值<br />public:<br />
2010-06-03 22:10:00 665
原创 人员信息管理(Ⅲ)
<br />class employee<br />{<br />protected:<br /> char name[20];<br /> int individualEmpNo; //个人编号<br /> int grade; //级别<br /> float accumPay; //月薪<br /> static int employeeNo; //本公司职员编号目前最大值<br />public:<br /> employee();<br /> ~e
2010-06-03 22:07:00 765
原创 人员信息管理(Ⅱ)
<br />class employee<br />{<br />protected:<br /> int individualEmpNo; //个人编号<br /> int grade; //级别<br /> float accumPay; //月薪<br /> static int employeeNo; //本公司职员编号目前最大值<br />public:<br /> employee();<br /> ~employee();<br /> void
2010-06-03 22:03:00 621
原创 人员信息管理(Ⅰ)
<br />class employee<br />{<br />protected:<br /> int individualEmpNo; //个人编号<br /> int grade; //级别<br /> float accumPay; //月薪<br />public:<br /> employee();<br /> ~employee();<br /> void IncreaseEmpNo(int); //增加编号函数<br /> void pro
2010-06-03 22:02:00 637
原创 fatal error C1010: unexpected end of file while looking for precompiled header directive
<br />在编译VC++6.0是,出现<br />fatal error C1010: unexpected end of file while looking for precompiled header directive<br /><br />问题详细解释:<br />致命错误C1010,在寻找预编译指示头文件时,文件未预期结束。就是没有找到预编译指示信息的头文件。<br /><br />问题一般发生在:<br />通过添加文件的方式,添加了一些cpp文件到一个MFC的程序,但该cpp文件并不是MF
2010-06-03 21:49:00 485
原创 Array类的应用:求范围2~n中的质数,n在程序运行时由键盘输入
<br />//Array.h<br />const int null = 0; <br />enum ErrorType //错误类型集合,共有三种错误:数组大小错误、内存分配错误和下标越界<br />{invalidArraySize,memoryAllocationError,indexOutOfRange};<br />char *errorMsg[]=<br />{<br /> "Invalid array size","Memory allocation error",<br /> "I
2010-06-02 20:28:00 1050
原创 栈的应用——一个简单的整数计算器
<br />实现一个简单的整数计算器,能够进行加、减、乘、除和乘方运算。使用时算式采用后缀输入法,每个操作数、操作符之间都以空白符分隔。乘方运算用“^”表示。每次运算在前次结果基础上进行,若要将前次运行结果清除,可键入“c”。当键入“q”时程序结束。<br />//stack.h<br />#include<iostream><br />#include<cstdlib><br />#include<cmath><br />#include<cstring><br />using namespace std
2010-06-02 10:25:00 871
转载 总结必须学习的10项.NET技术
1、WCF (Windows Communication Foundation):虽然WCF显然没有WPF或SilverLight那么吸引人,但是它却是在.NET框架下解决业务问题的基础。所以你今年至少要学习一门.NET的新技术,那你就选择WCF吧。 2、ADO.NET (and LINQ):这是让你与数据层打交道的技术。并且LINQ提供了将各种数据组合起来的方法。如果以上两个技术你都不熟悉的话,那就等着被人来抢你饭碗吧。 3、WPF (Windows Presentation Founda
2010-06-01 10:58:00 617 1
原创 单目运算符“++”重载为成员函数形式
#includeusing namespace std;class Clock{public: Clock(int NewH=0,int NewM=0,int NewS=0); void ShowTime(); Clock& operator ++(); Clock operator ++(int);private: int Hour,Minute,Second;};Clock::Clock(int NewH,int NewM,int NewS){ if(0 { Hou
2010-06-01 09:13:00 1436
原创 运算符重载为成员函数
#includeusing namespace std;class complex //复数类定义{public: complex(double r=0.0,double i=0.0) {real=r;imag=i;} complex operator + (complex c2); //运算符+重载成员函数 complex operator - (complex c2); //运算符-重载成员函数 void display();private: double real; double imag;
2010-06-01 09:11:00 999
原创 运算符重载为友元函数举例
#includeusing namespace std;class complex //复数类定义{public: complex(double r=0.0,double i=0.0) {real=r;imag=i;} friend complex operator + (complex c1,complex c2); //运算符+重载友元函数 friend complex operator - (complex c1,complex c2); //运算符-重载友元函数 void display(
2010-06-01 09:09:00 653
原创 冒泡排序举例
#includetemplatevoid Swap(T &x,T &y){ T temp; temp=x; x=y; y=temp;}template void BubbleSort(T A[],int n){ int i,j; int lastExchangeIndex; i=n-1; while(i>0
2010-05-31 20:53:00 608
原创 直接选择排序举例
<br />#include<iostream><br />template<class T><br />void Swap(T &x,T &y)<br />{<br /> T temp;<br /> temp=x;<br /> x=y;<br /> y=temp;<br />}<br /> <br />template <class T><br />void SelectionSort(T A[],int n)<br />{<br /> int smallIndex;<br />
2010-05-31 20:52:00 665
原创 直接插入排序举例
<br />#include<iostream><br />template<class T><br />void InsertionSort(T A[],int n)<br />{<br /> int i,j;<br /> T temp;<br /> for(i=1;i<n;i++)<br /> {<br /> j=i;<br /> temp=A[i];<br /> while(j>0&&temp<A[j-1])<br /> { <br /> A[j
2010-05-31 20:50:00 841
原创 折半查找函数模板举例
<br />初始化int类型数组data1={1,3,5,7,9,11,13,15,17,19,2,4,6,8,10,12,14,16,18,20},提示用户输入一个数字,应用折半查找函数模板找出它的位置。<br />#include<iostream><br />using namespace std;<br />template<class T><br />int BinSearch(T list[],int n,T key)<br />{<br /> int mid,low,high;<br />
2010-05-31 20:39:00 1796
原创 顺序查找函数模板举例
<br />初始化int类型数组data1[]={1,3,5,7,9,11,13,15,17,19,2,4,6,8,10,12,14,16,18,20},提示用户输入一个数字,应用顺序查找函数模板找出它的位置。<br />#include<iostream><br />using namespace std;<br />template<class T><br />int SeqSearch(T list[],int n,T key)<br />{<br /> for(int i=0;i<n;i++)<b
2010-05-31 20:36:00 1827
原创 C++中的引用和指针
<br />引用和指针有何区别?何时只能使用指针而不能使用引用? <br /> 引用是一个别名,不能为 NULL 值,不能被重新分配;指针是一个存放地址的变量。当需要对变量重新赋以另外的地址或赋值为 NULL 时只能使用指针。
2010-05-31 16:44:00 335
原创 C++中的引用和指针
<br />引用和指针有何区别?何时只能使用指针而不能使用引用? <br /> 引用是一个别名,不能为 NULL 值,不能被重新分配;指针是一个存放地址的变量。当需要对变量重新赋以另外的地址或赋值为 NULL 时只能使用指针。
2010-05-31 16:44:00 355
原创 拷贝构造函数与赋值运算符(=)有何不同?
<br />拷贝构造函数与赋值运算符(=)有何不同?<br /> 赋值运算符(=)作用于一个已存在的对象;而拷贝构造函数会创建一个新的对象。
2010-05-31 16:42:00 2384
原创 使用关键字const 而不是#define 语句的好处有哪些
<br />使用关键字 const 而不是#define 语句的好处有哪些?<br />解: <br />const 定义的常量是有类型的,所以在使用它们时编译器可以查错;而且,这些变量在调试<br />时仍然是可见的。
2010-05-31 16:41:00 1092
原创 编写程序定义Point类,有数据成员X,Y,为其定义友元函数实现重载+。
<br />#include <iostream.h><br />class Point<br />{<br />public:<br /> Point() { X = Y = 0; }<br /> Point( int x, int y ) { X = x; Y = y; }<br /> void Print() { cout << "Point(" << X << ", " << Y << ")" << endl; }<br /> friend Point operator+( Poin
2010-05-31 16:40:00 17059 2
原创 编写一个类Rectangle,有长itsLength,宽itsWidth等数据成员,有重载的构造函数Rectangle()、Rectangle(int width,int length)。
<br />#include<iostream><br />using namespace std;<br />class Rectangle<br />{<br />public:<br /> Rectangle() {itsLength=10,itsWidth=5;}<br /> Rectangle(int length ,int width) {itsLength=length;itsWidth=width;}<br /> ~Rectangle() {}<br /> int GetLe
2010-05-31 16:03:00 6454
原创 编写四个重载函数Double(x),返回值为输入参数的两倍;参数类型分别为int,long,float,double,返回值类型与参数类型一致。
<br />#include<iostream><br />using namespace std;<br />int Double(int x);<br />long Double(long x);<br />float Double(float x);<br />double Double(double x);<br />int main()<br />{<br /> int myInt = 6500;<br /> cout<<Double(myInt)<<endl;<br /> long
2010-05-31 15:44:00 2526
.Net c#使用PDFBox解析PDF文件
2011-04-20
VC动态链接库(dll)例子
2010-11-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人