⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linelist.cpp

📁 数据结构算法VC++实现
💻 CPP
字号:
//线性表的操作linelist.cpp
#include "linelist.h"
void List::init(List *L)
{L->elem=(ElemType *)malloc(LIST_INIT_SIZE*sizeof(ElemType));
 if(!L->elem) exit(OVERFLOW);
 L->length=0;
 L->listsize=LIST_INIT_SIZE;
}
int List::ListLength()
{return length;}
ElemType List::GetElem(int i,ElemType *e)
{*e=elem[i];return *e;}
bool List::ListInsert(int i,ElemType e)
{ ElemType *p,*q;
  if (i<0||i>length) return false;
  q=&elem[i];
  for(p=&elem[length];p>=q;--p)
    *(p+1)=*p;
  *q=e;
  ++length;
  return true;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -