TI论坛
直播中

陈强

7年用户 147经验值
私信 关注
[问答]

ccs3.3 if 语句的嵌套编译时出现"guochongguofang.c", line 30: error: expected a statement

这是我写的一点if 语句
if(0<=u3&&u3<=0.3)
[
if(u1<0)
[
if(u2<0)
[
if(0<=u4&&u4<=0.6)
y1=u1;
y2=u2;
else   // 这里编译的时候出现错误!!!
y1=u5;
y2=0;
]
else
[
if(0<=u4&&u4<=0.4)
[
if(u5>=0)
[
if((u4-0.2)/(0.4-0.2)>=0)
[
if((u3-0.05)/(0.3-0.05)>=0)
y1=(u5-u2*(u4-0.2)/(0.4-0.2))*(u3-0.05)/(0.3-0.05);
y2=u2*(u4-0.2)/(0.4-0.2);
else
y1=0;
y2=u5*(u4-0.2)/(0.4-0.2);
]
else
[
if((u3-0.05)/(0.3-0.05)>=0)
y1=u5*(u3-0.05)/(0.3-0.05);
y2=0;
else
y1=0;
y2=0;
]
]
else
[
if((u4-0.2)/(0.4-0.2)>=0)
y1=u5-u2*(u4-0.2)/(0.4-0.2);
y2=u2*(u4-0.2)/(0.4-0.2);
else
y1=u5;
y2=0;
]
]
else
y1=u1;
y2=u2;
]
]
else
[
if(u2<0)
[
if(0<=u4&&u4<=0.4)
[
if((u3-0.05)/(0.3-0.05)>=0)

[
if(u5>=0)
y1=u1*(u3-0.05)/(0.3-0.05);
y2=(u5-u1*(u3-0.05)/(0.3-0.05))*(u4-0.2)/(0.4-0.2);
else
y1=u1*(u3-0.05)/(0.3-0.05);
y2=u5-u1*(u3-0.05)/(0.3-0.05);
]
else
[
if(u5>=0)
y1=u5*(u3-0.05)/(0.3-0.05);
y2=0;
else
y1=u1*(u3-0.05)/(0.3-0.05);
y2=u5-u1*(u3-0.05)/(0.3-0.05);
]
]
else
[
if((u4-0.2)/(0.4-0.2)>=0)
[
if(u5>=0)

y1=0;
y2=u5*(u4-0.2)/(0.4-0.2);
else
y1=u5;
y2=0;
]
else
[
if(u5>=0)
y1=0;
y2=0;
else
y1=u5;
y2=0;
]
]
]
else
[
if(0.4 [
if((u3-0.05)/(0.3-0.05)>=0)
[
if(u5>=0)
y1=u1*(u3-0.05)/(0.3-0.05);
y2=u5-u1*(u3-0.05)/(0.3-0.05);
else
y1=u1*(u3-0.05)/(0.3-0.05);
y2=u5-u1*(u3-0.05)/(0.3-0.05);
]
else
[
if(u5>=0)
y1=0;
y2=u5;
else
y1=u5;
y2=0;
]
]
else
[
if((u3-0.05)/(0.3-0.05)>=0)
[
if((0.8-u4)/(0.8-0.6)>=0)
[
if(u5>=0)
y1=u1*(u3-0.05)/(0.3-0.05);
y2=u5-u1*(u3-0.05)/(0.3-0.05);
else
y1=u5-u2*(0.8-u4)/(0.8-0.6);
y2=u2*(0.8-u4)/(0.8-0.6);
]
else
[
if(u5>=0)
y1=u1*(u3-0.05)/(0.3-0.05);
y2=u5-u1*(u3-0.05)/(0.3-0.05);
else
y1=u5;
y2=0;
]
]
else
[
if((0.8-u4)/(0.8-0.6)>=0)
[
if(u5>=0)
y1=0;
y2=u5;
else
y1=u5;
y2=0;
]
else
[
if(u5>=0)
y1=0;
y2=u5;
else
y1=u5;
y2=0;
]
]
]
]
]
编译时出现"guochongguofang.c", line 30: error: expected a statement ,请问是什么引起的,应该怎么解决? 就是带有else的地方

回帖(1)

张琛根

2018-8-22 07:04:53
受到警告
提示: 作者被禁止或删除 内容自动屏蔽
举报

更多回帖

发帖
×
20
完善资料,
赚取积分