level 6
#include<stdio.h>
#include"sqlist.h"
int insert(sequenlist *L,int i,int x)
{int j;
if((*L).len>=MAXSIZE)
{printf("the list is overflow\n");
return NULL;
}
else if((i<1)||(i>(*L).len+1))
{ printf("position is not corrent.\n");
return NULL;
}
else{ for(j=(*L).len-1;j>=i-1;j--)
(*L).vec[j+1]=(*L).vec[j];
(*L).vec[i-1]=x;
(*L).len++;
return OK;
}
}
void main()
{
int n,i,x;
sequenlist *L,a;
printf("\n Input the length of the list L:\n");
scanf("%d",&n);
L=&a;
L->len=n;
createsqlist(L,n);
printf("\ninput the insert location:\n");
scanf("%d",&i);
printf("\ninput the insert data:\n");
scanf("%d",&x);
if(insert(L,i,x))
{printf("The length of the new list is:%d\n",L->len);
printf("Output the new list's data:\n");
for(i=0;i<L->len;i++)
printf("%d\n",L->vec[i]);
}
else
printf("can't insert the data!\n");
}
2016年09月28日 08点09分
3
level 11
先把代码保存,然后吧sqlist.h的文件放到保存的文件下
2016年09月29日 05点09分
6
怎么把sqlist.h的文件放到保存的文件下呢?
2016年09月29日 05点09分
@悠心冲冲 我说错了。放到和你源程序同级的文件夹下。
2016年09月29日 05点09分
@倾听风说情感 你能不能用c4droid帮我运行一下,截图教教我,感觉源程序创建不了文件夹,只能保存代码
2016年09月29日 05点09分
你有没有sqlist.h的文件?
2016年09月29日 06点09分
level 6
我这个SDL plugin for C4droid和GCC for C4droid是灰化的,这有没有安装上去呢?
2016年09月29日 08点09分
16
本来就是插件,没有图标和界面。
2016年09月30日 00点09分