Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - array class
Search - array class - List
The LZW compression class i mplemented as a fixed length code which you can specify, the huffman algorithm implementation encodes a byte into a variable length bit array. Both of them can work with streams
Date : 2008-10-13 Size : 7.74kb User : sdfsdfwe

The LZW compression class i mplemented as a fixed length code which you can specify, the huffman algorithm implementation encodes a byte into a variable length bit array. Both of them can work with streams
Date : 2026-01-19 Size : 7kb User : sdfsdfwe

 完成满足上述接口的动态数组(Dynamic array)的程序;  需要遵循基本的编程规范和风格;  动态分配内存用C++的函数new/delete,不用malloc/free;  处理好动态分配的运用,不要出现内存泄漏;  了解C++类的构造函数和析构函数的作用;  熟悉C++类的写法(*.h, *.cpp);  各种情况考虑周到,不要出现程序崩溃; - completed to meet the interface dynamic arrays (Dynamic array) the program  need to follow the basic programming norms and style  dynamic allocation of memory using C++ functions that new/delete, not malloc/free  handle the dynamic allocation of use Memory leaks do not occur  learn C++ class constructor and destructor role  know C++ class written (*. h,*. cpp)  thoughtful consideration all the circumstances, do not crash there
Date : 2026-01-19 Size : 247kb User : 陈婉

现在实现的类已经比较好了,用户使用起来很方便。 但是,新的问题又出来了。 上述的动态数组只能存储double类型的数据。想象一下,另一个用户也想用这个动态数组,但是他处理的数据是int类型的,该如何办? 当然,你可以再写一个基于int类型的动态数组类,你发现,大部分的代码都不要改动,只要将类型double变成int即可。 如果另一个用户需要处理的是float类型,还有用户处理的是char类型的….该怎么办? 这样做的缺点很显然:  这些类的代码大同小异,代码冗余;  当对这个类进行修改时,所有的这些类都要同时改,不利于代码维护; 有无办法解决这个问题?即,如果能把变量的“类型”也当作一个“变量”,不就可以了吗?这个在C中是不能解决的,但是在C++中,有一种新的机制template,就可以解决上述问题。Template的使用非常简单,大致的形式见: -Now the class has been better achieved, and the user is easy to use. However, the new issue came out again. The dynamic array can store double types of data. Imagine, another user would like to use this dynamic array, but his handling of the data is int type, how do? Of course, you can write a dynamic array of type int-based class, you find that most of the code have not changed, simply type int can become double. If another user needs to be addressed is the float type, there is the user dealing with the char type .... How to do? This disadvantage is clear:  similar code for these classes, code redundancy  When the right to modify this class, all of these classes should also change, is not conducive to code maintenance Any other way to solve this problem? That is, if the variable can "type" also as a "variable", not to the information? This can not be solved in C, but in C++, there is a new mechanism template, you can solve these problems.
Date : 2026-01-19 Size : 272kb User : 陈婉
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.