标签:ios nbsp list sqli class color loading mes include
1.顺序表的插入
数组的长度用引用型
#include<iostream>
using namespace std;
#define MaxSize 50
int inserElem(int a[],int &length,int p,int value){
if(p<0 || p>length || length==MaxSize){
return 0;
}
for(int i=length-1;i>=p;i--){
a[i+1]=a[i];
}
a[p]=value;
++length;
return 1;
}
int main(){
int sqList[MaxSize]={1,2,3,4,5,6,7,8};
int length=8;
//在顺序表下标为3的位置插入一个值为25的数据
inserElem(sqList,length,3,25);
for(int i=0;i<length;i++){
cout<<sqList[i]<<‘ ‘;
}
return 0;
}
2.顺序表的删除
int deleteElem(int a[],int &length,int p,int &e){ if(p<0 ||p>length-1){ return 0; } e=a[p]; for(int i=p;i<length-1;i++){ a[i]=a[i+1]; } length--; return 1; }
标签:ios nbsp list sqli class color loading mes include
原文地址:https://www.cnblogs.com/jcahsy/p/13171291.html