c语言程序错误求大神改错
#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)
#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)
...全文
相关推荐
C语言程序改错基本题库.doc
C语言程序改错基本题库本资源摘要信息是关于C语言程序改错基本题库的知识点汇总。该资源库包含8个程序改错题目,每个题目都有明确的错误描述和改正方法。
C语言程序改错基本题库.docx
C语言程序改错基本题库本资源摘要信息是对C语言程序改错基本题库的总结,涵盖了八个不同的程序改错题目,每个题目都具有其独特的错误和改正方法。1.
C语言程序设计实验与习题答案.doc
"C语言程序设计实验与习题答案"本资源摘要信息涵盖了C语言程序设计实验与习题答案,包括程序填空、程序改错、设计性实验等多方面的内容。
最新真正二级C语言机试300题(含填空、改错、编程)并含解析及答案
### 二、改错题改错题主要考察考生对C语言语法细节的理解和把握能力。常见的错误类型包括但不限于:- **语法错误**:如括号不匹配、分号缺失等。
计算机等级考试二级C语言上机考试必读.pdf
《计算机等级考试二级C语言上机考试必读》这份资料主要针对全国计算机等级考试二级C语言的上机部分,包括改错题和编程题的解答策略及常见错误解析。


