i信息学奥赛

加入QQ群:1025629106,或关注微信公众号:i信息学奥赛,获取更多学习资源。

导航

顽皮的小球

Posted on 2016-12-12 14:21  shnoip  阅读(216)  评论(0编辑  收藏  举报
感谢世外苏子恒同学提供
 
uses crt;
var
  x,y,xd,yd:shortint;
 
procedure intro;
begin
  clrscr;
  writeln;
  writeln;
  writeln;
  writeln;
  writeln;
  writeln('Naughty ball':46);
  writeln('--by suziheng':55);
  writeln;
  writeln;
  writeln('Press CTRL+C to exit the program.':57);
  writeln;
  writeln;
  writeln('Press Enter to start the program.':57);
  readln;
end;
 
begin
  xd:=1;
  yd:=1;
  x:=2;
  y:=2;
  intro;
  cursoroff;
  while true do begin
    x:=x+xd;
    y:=y+yd;
    clrscr;
    gotoxy(x,y);
    write('O');
    delay(100);
    if (x=80) or (x=1) then xd:=-xd;
    if (y=25) or (y=1) then yd:=-yd;
  end;
end.