读书人

如何数据结构(c)算法错哪了求求大

发布时间: 2012-03-25 20:55:16 作者: rapoo

怎么数据结构(c)算法哪里错了,求求大家帮我改下谢谢,
#define ListSize 100
typedef int Datatype;
typedef struct{
Datatype data[ListSize];
int length;
}Seqlist;

main()
{

void InsertList(Seqlist * L,Datatype x,int i);
}

void InsertList(Seqlist * L,Datatype x,int i)
{ int j;
if(i<1||i>L->length+1)
error("position error");
if(L->length>=ListSize)
error("overflow");
for(j=L->length-1;j>=i-1;j--)
L->data[j+1]=L->data[j];
L->data[i-1]=x;
L->length++;
}

C++中出现warning C4013: 'error' undefined; assuming extern returning int
这个是‘error’没有声明吗?请大家帮我修改下,谢谢

[解决办法]
1.把main函数里的那个void去掉
2。把error语句都改为cout输出:比如第一个error("position error");
改为:cout<<"position error\n";
3.不清楚楼主想输出什么东西,呵呵

读书人网 >C语言

热点推荐