首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

如何数据结构(c)算法错哪了,求求大家帮小弟我改下多谢

2012-03-25 
怎么数据结构(c)算法哪里错了,求求大家帮我改下谢谢,#define ListSize 100typedef int Datatypetypedef s

怎么数据结构(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.不清楚楼主想输出什么东西,呵呵

热点排行