菜鸟请教!hurry up!

whoami395 2003-09-29 10:55:35
当我用tc编译这个程序时候,它说我有以下错误:
F:\tc\Xx.c(6) : error C2143: syntax error : missing ';' before 'type'
F:\tc\Xx.c(7) : error C2143: syntax error : missing ';' before 'type'
F:\tc\Xx.c(8) : error C2143: syntax error : missing ';' before 'type'
F:\tc\Xx.c(12) : error C2065: 'a' : undeclared identifier
F:\tc\Xx.c(12) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(12) : error C2065: 'b' : undeclared identifier
F:\tc\Xx.c(12) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(12) : error C2065: 'c' : undeclared identifier
F:\tc\Xx.c(12) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(12) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(13) : error C2106: '=' : left operand must be l-value
F:\tc\Xx.c(13) : error C2143: syntax error : missing ';' before 'if'
F:\tc\Xx.c(13) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(13) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(13) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(13) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(13) : error C2106: '=' : left operand must be l-value
F:\tc\Xx.c(14) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(14) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(15) : error C2106: '=' : left operand must be l-value
F:\tc\Xx.c(15) : error C2143: syntax error : missing ';' before 'if'
F:\tc\Xx.c(15) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(15) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(15) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(15) : error C2109: subscript requires array or pointer type
F:\tc\Xx.c(15) : error C2106: '=' : left operand must be l-value
Error executing cl.exe.不明白!
我的源代码:void main()
{int i,j,k;
i=0;
j=0;
k=0;
int a[10];
int b[10];
int c[20];
for(i=0;i<=9;i++)
for(j=0;j<=9;j++)
for(k=0;k<=9;k=k+2)
if(a[i]<=b[j])c[k]=a[i]
if(b[j]<=a[i+1])c[k+1]=b[j];
else b[j]=c[k]
if(a[i]<=b[j+1])c[k+1]=a[i];
}


...全文
114 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
whoami395 2003-09-30
  • 打赏
  • 举报
回复
i have solve this problem,thx !
deathsky 2003-09-30
  • 打赏
  • 举报
回复
int main()
{int i,j,k;
int a[10];
int b[10];
int c[20];
for(i=0;i<=9;i++)
for(j=0;j<=9;j++)
for(k=0;k<=9;k=k+2)
{
if(a[i]<=b[j])
c[k]=a[i];
if(b[j]<=a[i+1])
c[k+1]=b[j];
else b[j]=c[k];
if(a[i]<=b[j+1])
c[k+1]=a[i];
}
getch();
}
这么修改可以编译通过,
由于不知道你的程序的功能,
对于你的程序上的逻辑上的问题无法修改
existsluawjb 2003-09-30
  • 打赏
  • 举报
回复
变量的声明要在最上面,而且编程的风格太差了
FOR循环内的循环要缩进
xdspower 2003-09-30
  • 打赏
  • 举报
回复
huigll() 指出你的错误了,你的编码习惯太不好了,完全没有层次,你先学习一下Python好了
clarkralf 2003-09-29
  • 打赏
  • 举报
回复
呵呵,最原始的C语言,一开始大多数人都不知道变量定义要在最前面的
simclock 2003-09-29
  • 打赏
  • 举报
回复
变量的定义要在最前面
huigll 2003-09-29
  • 打赏
  • 举报
回复
void main()
{int i,j,k;
i=0;
j=0;
k=0;
int a[10];
int b[10];
int c[20];
for(i=0;i<=9;i++)
for(j=0;j<=9;j++)
for(k=0;k<=9;k=k+2)
if(a[i]<=b[j])c[k]=a[i];/**/
if(b[j]<=a[i+1])c[k+1]=b[j];
else b[j]=c[k];/**/
if(a[i]<=b[j+1])c[k+1]=a[i];
}

69,369

社区成员

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

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