- 博客(18)
- 收藏
- 关注
原创 Which function is called when use virtual function.
class b{public: virtual void mf( int p ) ;} ;void b::mf( int p ){ cout }class d : public b{public: void mf( double p ) ;} ;void d::mf( double p ){ cout }void main(){ b *ptr ; ptr =
2005-04-25 15:12:00 845
原创 Which function is called?
class b{public: virtual void mf( int p ) ;} ;void b::mf( int p ){ cout }class d : public b{public: void mf( double p ) ;} ;void d::mf( double p ){ cout }void main(){ b *ptr ; ptr =
2005-04-25 15:02:00 915
原创 Another form of default constructor
Define a book class:class book{public: book( int newISBN = 0, string newName = "" ) ;// Other member functions...private: int ISBN ; string Name ; } ;book::book( int newISBN, int newName ){ ISBN =
2005-04-07 20:09:00 613
原创 Differenct between return by value and by reference
Consider the following code://==================================1 int max( int& n1, int& n2 )2 {3 if(n1>n2)4 return n1 ;5 else6 return n2 ;7 }8 void main()9 {10
2005-04-03 15:40:00 775
原创 A const object can only call const function
consider the following class//=========================================================class cal_date{ public: bool is_leap_year( void ) const ; private: int year ; int month ; int day ;
2005-03-26 11:45:00 772
原创 Access out of range
Suppose OneLineText is a stringDont forget to check the index or it could be out of range! Lenthg checking must performe at first rather than access the char in the string or the string will be also
2004-11-13 11:02:00 1293
原创 Struct is the same as int and float
int:int Number=0;Number=InputNumber();=============================struct Date{ int Day; int Month; int Year;};struct Person{ struct Date DOB; char Name[16];};struct Date InputDOB(){ struct Date D
2004-09-17 20:20:00 597
原创 About "feof()"
看下面这个程序,怎么会输出两次呢?如果feof()没问题的话,请告诉我为什么?#includemain(){FILE *fp;int n=74,k;printf("/n");fp=fopen("joseph.b","wb+");fwrite(&n,2,1,fp);fclose(fp);fp=fopen("joseph.b","rb+");while(!feof(fp)){fread(&k,2,1,
2004-09-17 19:09:00 995 1
原创 The meaning of p->Next==NULL
Assume a node p.p->Next means its an empty list or it is the end node. PS: In other words, an empty list is also another form of the end node.
2004-09-12 11:28:00 779
原创 Operation PRI
While doing EX22PG199 in the book written by Paul.Kelly, I want to take out the value in an two dim array using the following code:fElementOfMatrixA=*(float*)ppMatrixA + MatrixA.Cols*i + k;it doesnt
2004-09-10 17:12:00 747
原创 Pass two dim array!
如何将二维数组作为函数的参数传递 作者: jatix 邮箱: jatix@163.com QQ: 52287017声明: 如果你是得道的大侠,这篇文章可能浪费你的时间,如果你坚持要看,我当然感觉很高兴,但是希望你看完了别骂我!如果你发现我这篇文章有错误的话,你可以提出批评以及指正,我将很乐意地接受。*_*概述: 今天写程序的时候要用到二维数组作参数传给一个函数,我发现将二
2004-09-09 16:43:00 875
原创 Print the macro number
#define NUMBER 10if you want to print the number 10 on the screen, the code is: printf(“%d“,NUMBER); - END -
2004-08-23 22:59:00 616
原创 No return value when using recrusion
The following code will pass the complie, but with wring message in Borland C++Builder 6.0: [C++ Wring] EX14PG197.c(99): W8070 Function should return a valueWhat shall I do to remove the message?
2004-08-23 22:32:00 907 1
原创 Shall I keep the previous version?
If I have found something wrong with my code, I try to modify it. After doing that, shall I keep the previous for refrence? If the answer is true, how could I do it properly? (e.g. record the mod
2004-08-23 08:19:00 593
原创 The last Node of Link List
The Last node should pointer to itself, as following: Node *z = new Node; z->Next = z;That could display the records N rather than N+1.The display condition should be written as:
2004-08-20 11:03:00 622
原创 Something about float divide
The experession fVolume = CalculateCylinderVolume(fRadius,fHeight) / 3;will be all right, while: fVolume = (1/3) * CalculateCylinderVolume(fRadius,fHeight) ;will be wrong, the result is 0.00-E
2004-08-19 21:10:00 618
原创 The Program Extention
Problem Description: A manufactured item can have one of the solid shapes cone, cylinder or rectangle and can be made from one of a number of materials,
2004-08-18 22:06:00 565
原创 Grid Table Style Print
If you want print a report as following:Staff no. Hours Worked Pay rate Gross paydddd dd dd ddThe code is:printf("/nStaff no. Hours Worked Pay rate Gross pay"
2004-08-10 21:33:00 546
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人