大家给看看,一个小小的 Pascal 小程序,为何老是编译通不过??
program xy2 (input , output);
var
x,y:integer;
begin
write( 'Please input X: ');
read(x);
if x> 40 then begin
writeln( 'Is too big! Please input again! ');
write( 'Please input X: ');
read(x)
end;
case x of
0 : y:=0;
1,2,3,4,5,6,7,8,9,10 : y:= x;
11,12,13,14,15,16,17,
18,19,20 : y:=10;
21,22,23,24,25,26,27,
28,29,30,31,32,33,34,
35,36,37,38,39 : y:=((0.5)*x+20)
end;
writeln( 'If x= ',x, ' Then y= ',y);
end.
[解决办法]
35,36,37,38,39 : y:=((0.5)*x+20)
========================================
35,36,37,38,39 : y:=round(((0.5)*x+20))