#include<iostream>
using namespace std;
#define START 8
#define ERROR 0
#define OK 1
typedef struct Sqlist{
int *elem;
int length;
int listsize;
}SqList;
void print(SqList l)
{
int i;
for(i=1;i<=l.length;i++)cout<<l.elem[i]<<" ";
cout<<endl;
}
void Initlist(SqList &L)
{
L.elem=(int*)malloc(START*sizeof(int));
L.length=7;
}
int ListInsert(SqList &L,int i,int e)
{
int *q;
if(i<1 || i>L.length+1) return ERROR;
q=L.elem+i; //q为插入位置
cout<<"请输入插入元素";
cin>>e;
*q=e; //插入e
return OK;
}
int ListDelete(SqList &L,int i,int &e)
{
int *p,*q;
cout<<"请输入被删除元素的位序";
cin>>i;
if((i<1)||(i>L.length)) return ERROR;
p=&(L.elem[i-1]); //被删除元素的位置
e=*p; //被删除元素赋给e
q=L.elem+L.length; //最后一个元素的位置
for(++p;p<q;++p)
*p=*(p+1); //后面元素前移
--L.length;
return OK;
}
int main()
{
Sqlist L;
Initlist(L);
int i,e;
for(i=1;i<8;i++)
ListInsert(L,i,e);
cout<<"输出原始线性表"<<endl;
print(L);
ListDelete(L,i,e);
cout<<"输出删除元素后线性表"<<endl;
print(L);
system("pause");
return 1;
}
没有合适的资源?快使用搜索试试~ 我知道了~
数据结构 几个完整程序
共82个文件
cpp:14个
pdb:8个
obj:7个
5星 · 超过95%的资源 需积分: 10 13 下载量 38 浏览量
2010-06-08
00:49:43
上传
评论 1
收藏 2.53MB RAR 举报
温馨提示
这是对数据结构的几个程序,如果是初学者建议下下,希望给您的学习带来惊喜!
资源推荐
资源详情
资源评论
收起资源包目录
.rar (82个子文件)
数据结构
luolin4.cpp 641B
luo.plg 2KB
luolin4.plg 2KB
luolin.cpp 0B
luolin4.ncb 49KB
数据结构程序
栈的输入输出.txt 1KB
队列的输入输出.txt 943B
线性表插入与删除.txt 1KB
单链表的输入输出.txt 856B
luo.dsp 3KB
luolin4.dsp 3KB
luolin5.cpp 5KB
luolin4.dsw 522B
cc
ll.plg 2KB
ll.cpp 670B
ll.dsp 3KB
ll.dsw 512B
luolin1.cpp 2KB
Debug
vc60.pdb 84KB
vc60.idb 65KB
ll.pch 1.91MB
ll.ncb 33KB
ll.opt 48KB
luolin7.cpp 2KB
luo.opt 48KB
luo.dsw 514B
Debug
luolin4.obj 7KB
vc60.pdb 108KB
luo.pch 1.91MB
luolin4.pdb 409KB
罗林.obj 14KB
vc60.idb 121KB
luolin4.ilk 238KB
luolin5.obj 10KB
luolin4.exe 208KB
luolin4.pch 182KB
luo3
lu.cpp 1KB
x.dsw 510B
x.plg 622B
x.opt 53KB
Debug
x.pdb 561KB
vc60.pdb 100KB
vc60.idb 73KB
x.pch 1.91MB
x.obj 14KB
x.ilk 350KB
x.exe 240KB
sd.obj 14KB
x.ncb 41KB
x.cpp 1KB
sd.cpp 1KB
x.dsp 3KB
luolin4.opt 53KB
luo.cpp 943B
luolin2
Untit.cpp 1KB
luolin2.dsp 3KB
luolin2.dsw 522B
luolin2.ncb 41KB
luolin2.cpp 2KB
luolin3.cpp 2KB
luolin3.ncb 33KB
Debug
vc60.pdb 116KB
luolin3.obj 148KB
luolin2.pch 248KB
luolin2.exe 208KB
vc60.idb 81KB
luolin3.pch 1.97MB
luolin2.pdb 505KB
luolin3.pdb 1.06MB
luolin2.obj 8KB
luolin2.ilk 240KB
luolin3.exe 528KB
luolin3.ilk 767KB
luolin3.plg 753B
luolin3.opt 48KB
luolin2.plg 753B
luolin2.opt 53KB
luolin.2 2KB
luolin3.dsp 3KB
luolin3.dsw 522B
luo.ncb 41KB
xx
zuoye
zuoye.cpp 1KB
共 82 条
- 1
资源评论
- 小小小小小仙女2015-05-26详细具体,实用
Ronrey
- 粉丝: 13
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- date0425111111111111111111111
- 包含贪心算法的定义及python代码部分实现
- 自动驾驶-状态估计和定位之扩展卡尔曼滤波.pdf
- csdn之x-ca-key,x-ca-nonce,x-ca-signature与x-ca-signature-headers探索
- 基于TM1620数码显示芯片STM32单片机驱动程序软件源代码.zip
- 【tomcat6使用redis配置session共享】
- 包含杨辉三角的说明及java代码实现
- FDN371N-NL-VB一款SOT23封装N-Channel场效应MOS管
- AutomotiveSPICE-V4.0 中文版
- Java实现杨辉三角的生成和打印代码示例.md
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功