恳请各位老师帮小弟解决
#include <stdio.h>#include <stdlib.h>
#define MAXSIZE 5
typedef int ElemType;
typedef struct{
ElemType *elem;
int length;
}SqList;
void InitList(SqList &L);/*您需要编写的代码*/
int ListDelete(SqList &L,int i);
int main()
{
SqList L;
InitList(L);
int i;
scanf("%d",&i);
int result=ListDelete(L,i);
if(result==0){
printf("Delete Error.The value of i is illegal!");
}else if(result==1){
printf("Delete Success.The elements of the SequenceList L are:");
for(int j=0;j<L.length;j++){
printf(" %d",L.elem);
}
}
return 0;
}
int ListDelete(SqList &L,int i){
int j;
if(i > L.length || i < 1)
return 0;
for(j = i-1;j < L.length ;j++){
L.elem = L.elem;
}
L.length--;
return 1;
}
/* 请在这里填写答案 */ 数据结构链表??{:10_266:} Gacy 发表于 2021-6-16 23:12
数据结构链表??
是呀
页:
[1]