主题:麻烦大家忙解决一下
大家忙我看一下 我错在那了 自己找不出错误 是在线性表里插如一个数.#include<stdio.h>
typedef struct
{
int *elem ;
int length;
int listsze;
}sqlist;
stadus Insert_SqList(SqList &va,int x)
{ int i;
if(va.length+1>va.listsize) return ERROR;
va.length++;
for(i=va.length-1;va.elem[i]>x&&i>=0;i--)
va.elem[i+1]=va.elem[i];
va.elem[i+1]=x;for(i=0;i<=length;i++) printf("%d",va.elem[i]);
return OK;
}
main()
{sqlist l;int b;scanf("%d",&b);l.length=9;
l.listsize=10;
int a[10]={1,2,7,10,11,13,14,17,20};
l.elem=a;Insert_SqList(l,b);}
typedef struct
{
int *elem ;
int length;
int listsze;
}sqlist;
stadus Insert_SqList(SqList &va,int x)
{ int i;
if(va.length+1>va.listsize) return ERROR;
va.length++;
for(i=va.length-1;va.elem[i]>x&&i>=0;i--)
va.elem[i+1]=va.elem[i];
va.elem[i+1]=x;for(i=0;i<=length;i++) printf("%d",va.elem[i]);
return OK;
}
main()
{sqlist l;int b;scanf("%d",&b);l.length=9;
l.listsize=10;
int a[10]={1,2,7,10,11,13,14,17,20};
l.elem=a;Insert_SqList(l,b);}