头文件:
//Sorting.h
#ifndef DATALIST_H
#define DATALIST_H
#include<iostream>
using namespace std;
const int DefaultSize = 100;
template<typename T>
class Element {
public:
T key; //排序码
//field otherdata;
Element<T>& operator = (const T & x)
{
key = x;
return *this;
}
bool operator == (Element<T> & x) { return key == x.key; }
bool operator <= (Element<T>& x) { return key <= x.key; }
bool operator >(Element<T>& x) { return key > x.key; }
bool operator <(Element<T>& x) { return key < x.key; }
friend std::ostream &operator<<(ostream &output, const Element &D)
{
output << D.key;
return output;
}
friend std::istream &operator>>(istream &input, Element &D)
{
input >> D.key;
return input;
}
};
template<typename T>
class dataList {
public:
dataList(int maxSz = DefaultSize):maxSize(maxSz),currentSize(0) //construct func
{
Vector = new