c语言程序错误求大神改错

qq_41891879 2018-03-24 01:01:23
#include<stdio.h>
#include<stdlib.h>
typedef struct
{
int data[100];
int length;
}sequenlist;
int main()
{
void creat(sequenlist *L);
void show(sequenlist *L);
void find(sequenlist *L);
void insert(sequenlist *L);
void Delete(sequenlist *L);
void sort(sequenlist *L);
void inversed(sequenlist *L);
sequenlist *L,a;
L=&a;
creat(L);
show(L);
find(L);
insert(L);
show(L);
Delete(L);
show(L);
sort(L);
show(L);
inversed(L);
show(L);
return 0;
}
void creat(sequenlist *L)
{
printf("Input the lenght of the list L:\n");
int j=0;
scanf("%d",&L->length);
printf("Input the contennt:\n");
for(j;j<L->length;j++)
scanf("%d",&L->data[j]);
}
void show(sequenlist *L)
{
int j=0;
printf("Output the list and its length:\n");
for(j;j<L->length;j++)
printf("%d",L->data[j]);
printf("\n");
printf("the lenght is %d\n",L->length);
printf("\n");
}
void find(sequenlist *L,int n)
{
int a,m,j;
printf("please enter the number you want to find:\n");
scanf("%d",&a);
m=0;
for(j=0;j<L->length;j++)
{if(L->data[j]==a)
{printf("the number is %d\n",L->data[j]);
printf("it's the %d number\n",m);}
else
m=m+1;
}
}
void insert(sequenlist *L)
{
int i,j,e;
printf("please enter the place you want to insert:\n");
scanf("%d",&i);
printf("please enter the number:\n");
scanf("%d",&e);
if((i<1)||(i>L->length+1))
printf("error\n");
j=L->length;
if(j;j>i-1;j--)
L->data[j+1]=L->data[j];
L->data[i-1]=e;
++L->length;
}
error C2143: syntax error : missing ')' before ';'
(75) : warning C4390: ';' : empty controlled statement found; is this the intent?
(75) : warning C4552: '>' : operator has no effect; expected operator with side-effect
(75) : error C2059: syntax error : ')'
(76) : error C2146: syntax error : missing ';' before identifier 'L'
执行 cl.exe 时出错.

1.obj - 1 error(s), 0 warning(s)
...全文
481 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
生命练习生123 2018-03-24
  • 打赏
  • 举报
回复
怎么没有初始化
自信男孩 2018-03-24
  • 打赏
  • 举报
回复
for (;j>i-1;j--)
        L->data[j+1]=L->data[j];
insert函数里,这儿应该是for,而不是if
void find(sequenlist *L,int n)
这儿是定义,但是声明时却是一个参数,定义时是2个参数;
for(;j<L->length;j++)   
      printf("%d",L->data[j]);
去掉for循环中第一个表达式j,这儿没有意义;

69,369

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧