我想知道当程序启动时用户可以输入他的坐标的可能性,并且他可以通过按<TAB>
跳过这一段。当你点击程序时,程序应该进行随机坐标检查,即直到(ch = $ 9)
的成本。但它对我不起作用。请告诉我,我该如何修复代码?
uses crt, graphabc;
var
x,y: array[1..16] of real;
s:array[1..16] of char;
i,p,t,w,f,c:integer;
z:string;
const
a=14;
b=29;
r=27;
procedure ReadKey(ch : char);
begin
SetWindowSize(840, 600);
randomize;
t:=0;
w:=10;
f:=0;
Coordinate.Origin:=new Point(20,120);
for i:=1 to 15 do
begin
if i=1 then
begin
if (ch = $9) then begin
Coordinate.Origin:=new Point(0,0);
line(8, 8, 260, 8);
line(8, 30, 260, 30);
line(8, 8, 8, 30);
line(260, 8, 260, 30);
TextOut(15, 10, 'Enter your coordinates through a space');
Coordinate.Origin:=new Point(10,110);
readln(x[1],y[1]);
end;
until(ch = $9);
end;
s[i]:=chr(64+i);
x[i+1]:=(-30+(34+30)*random);
y[i+1]:=(-35+(34+35)*random);
writeln(s[i],'(', x[i]:3:0, ';',y[i]:3:0,')');
if (x[i]*x[i]+y[i]*y[i]<=r*r) and (x[i]>=0) or
(x[i]*x[i]+y[i]*y[i]<=r*r) and (x[i]<=-4) or
(x[i]*x[i]+y[i]*y[i]<=r*r) and (x[i]<=0) and (y[i]<=round(-b/2)) or
(x[i]*x[i]+y[i]*y[i]<=r*r) and (x[i]<=0) and (y[i]<=round(b/2))
then t:=t+1;
if (x[i]*x[i]+y[i]*y[i]>r*r) then begin
TextOut(65, f, ' - point outside the boundary of a circle');
f:=f+16;
end
else if (x[i]*x[i]+y[i]*y[i]=r*r) then begin
TextOut(65, f, ' - the point hit the outer border');
f:=f+16;
end
else if (x[i]*x[i]+y[i]*y[i]<=r*r) and (x[i]>=0) or
(x[i]*x[i]+y[i]*y[i]<=r*r) and (x[i]<-14) or
(x[i]*x[i]+y[i]*y[i]<=r*r) and (x[i]<=0) and (y[i]<round(-b/2)) or
(x[i]*x[i]+y[i]*y[i]<=r*r) and (x[i]<=0) and (y[i]=round(b/2))
then begin
TextOut(65, f, ' - the point hit the inner border');
f:=f+16;
end
else begin
TextOut(65, f, ' - the point fell outside the internal border');
f:=f+16;
end
end;