数据结构之C++实现顺序表(SeqList)无主函数

#include 
using namespace std;
#define SIZE 10
class SeqList
{
public:
	SeqList()
	{
		m_capacity = SIZE;
		m_data = new int[m_capacity];
		m_size = -1;
	}
	~SeqList()
	{
		delete []m_data;
		m_data=NULL;
		m_capacity=0;//可有可无
		m_size = -1;//同上注释
	}
	void PushBack(int v);
	void PushFront(int v);
	void insertValue(int i,int v);
	void PopBack();
	void PopFront();
	void DeleteValue(int i);
	bool IsEmpty(){return m_size == -1 ? true : false;}
	bool IsFull(){return m_size == m_capacity-1 ? true:false;}
	void Clear();
	void Destroy();
	void Sort();
	void Reverse();
	int Find(int value);
	void print()
	{
		for(int i = 0;i0;i--)
			m_data[i] = m_data[i-1];
		m_data[0] = v; 
		++m_size;
	}
}
void SeqList::insertValue(int i,int v)
{
	if(i>=0&&i<=m_size+1 && !IsFull())
	{
		for(int j = m_size+1;j>i;j--)
			m_data[j] = m_data[j-1];
		m_data[i] = v;
		++m_size;
	}
}
void SeqList::PopBack()
{
	if(!IsEmpty())
		m_size--;
}
void SeqList::PopFront()
{
	if(!IsEmpty())
	{
		for(int i = 0;i=0 && i<=m_size&&!IsEmpty())
	{
		for(int j = i;j

你可能感兴趣的:(数据结构之C++实现顺序表(SeqList)无主函数)