讨论 / 怎么错了?
85561642 2011-10-31 08:04:00
点我顶贴 收藏 删除
var s:string;

t,i,n,xx,x,y:longint;

begin

read(n);

for i:=1 to n do begin

readln(s);

if s=’left’ then begin

t:=1;

if s=’right’ then begin

t:=-1;

end

else begin

xx:=ord(s)-48;

if t=0 then y:=y+xx;

if t=1 then x:=x-xx;

if t=2 then x:=x+xx;

end;

end;

writeln(’(’,x,’,’,y,’)’);

end;

end.

说这里错了

xx:=ord(s)-48;

#1 Xs@2011-10-31 08:04:00
回复 删除
回复

s的定义是string字符串类型.ord函数后面只能加char字符类型.

你可以定义一个s1:char 把s的值赋给s1让后就可以了

查看更多回复
提交回复