/*
顺序表的操作
#include<iostream>
#include<stdlib.h>
using namespace std;
Relea 13.12 rev 9501 (2013/12/25 19:25:45) gcc 4.7.1 Windows/unicode - 32 bit
how to forget
#define MAX_SIZE 100
typedef struct
{
int *emel;
int lenth;
}Sq;
void init(Sq &l);
void create(Sq &l);
void trval(Sq &l);
void find_value(Sq &l);
void find_position(Sq &l);
void inrt(Sq &l);
heal the world下载void dele(Sq &l);
int main()
{
Sq l;
init(l);
create(l);
trval(l);
find_value(l);
find_position(l);
inrt(l);
trval(l);
dele(l);
trval(l);
return 0;
}
void init(Sq &l)
{
l.emel =new int[MAX_SIZE];
l ==NULL)
{
cout<<"\t申请空间失败!"<<endl;
exit(1);
}
l.lenth=0;
cout<<"\t成功申请空间!该顺序表的长度目前为:"<<l.lenth<<endl;
}
void create(Sq &l)
{
cout<<"\t请输入你想输入元素的个数:";
int x;
cin>>x;
if((x<1)&&(x>MAX_SIZE))
{
cout<<"\t你说输入的数不在范围里"<<endl;
return;
}
int i;
for(i=0;i<x;i++)
{
cin>&l[i];
frosting
}
l.lenth=x;
cout<<"\t成功赋值!"<<endl;
}
void trval(Sq &l)
{
int i;
捐赠支出 cout<<"l(";
snake什么意思
for(i=0;i<l.lenth;i++)
{
cout<&l[i]<<" ";
}
cout<<")"<<" 该顺序表现在的长度为:"<<l.lenth<<endl;
}
void find_value(Sq &l)
{
int x,t=0;
cout<<"\t请输入你要查找的值:";
liquidmetal cin>>x;
int i;
for(i=0;i<l.lenth;i++)
{
l[i]==x)
{
almost human
t=1;
cout<<"\t成功找到该元素,它是顺序表的第"<<i+1<<"个元素!"<<endl;
}
}
if(t==0)
{
cout<<"\t无该元素!"<<endl;
}
}
void find_position(Sq &l)
{
int x;
cout<<"\t请输入你要查找的位置:";
cin>>x;
int i;
if((x<1)||(x>l.lenth))
{
ossine
cout<<"\t输入的值不在范围内!"<<endl;
return;
}
conclusion for(i=1;i<=l.lenth;i++)
{
if(i==x)
{
cout<<"\t成功找到该元素,该值是"<&l[i-1]<<endl;
}
}
}
void inrt(Sq &l)
{
int i,x,y;
cout<<"\t请输入你要插入的位置";
cin>>x;
cout<<"\t请输入你要插入的值";
cin>>y;
if((x<1)||(x>l.lenth))
{
cout<<"\t输入的值不在范围内!"<<endl;
return;
}
if(x==l.lenth)
牛津大学学费 {
l.emel[l.lenth]=y;
l.lenth=l.lenth+1;
return;