跪求一个500行左右用C++编写的程序随便什么都行

来源:百度知道 编辑:UC知道 时间:2024/05/17 08:38:57

#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
template<class T> class Array { public: enum { __MIN_SIZE = 32 * 1024 }; typedef int (* __Comp)(const T *p1, const T *p2); public: Array() { Init(); } ~Array() { Destroy(); } private: Array(Array<T> &a); Array<T> & operator=(const Array<T> &a); public: inline T * Buffer() { return m_buffer; } inline int Length() const { return m_length; } private: inline void Init() { m_buffer = NULL; m_length = m_size = 0; } void Destroy(); void Resize(int size); void Insert(int i, const T &elem); int BFindRange(const T &elem, __Comp comp); public: void Append(const T &elem, __Comp comp); int BFind(const T &elem, __Comp comp); public: inline T & operator[](int i){ return m_buffer[i]; } private: T * m_buffer; int m_length; int m_size; }; template<class T>