Pascal:代码200行

2017-01-19主要更新:更新游戏错误,修复注册不能运行问题

注意:如果在FPC调试的时候,在主页(见图一)输入register会201错误的话,请在主页先键入login,再在user:(见图二)的地方输入register!

(图片一)  

 

(图片二)

差不多两百行,拥有注册,登录,无聊的游戏。会一直更新,希望大家多多指教!

系统2.1.1
uses crt;
var
  a,b:array[1..1000] of string;
  x,y,us,l,k,cha,s:string;
  i,aq,j,t,ss:longint;
  yy,kk,ll:array[0..10000] of char;

procedure Build_the_website;
begin
  clrscr;
  writeln('Sorry,build the website page not found!');
  writeln('Please Enter to exit!');
  readln;
  exit;
end;
procedure Game;
begin
  clrscr;
  writeln('Eat water game!Input Q-R-Q-R-Q......!(A line of a!)');
  aq:=50;
  i:=1;
  t:=55;
    for t:=55 downto 1 do
    begin
      readln(cha[t]);
      upcase(cha[t]);
      if (cha[t]='Q') and (cha[t-1]='R') or (cha[t]='R') and (cha[t-1]='Q') then aq:=aq-1;
      if aq=0 then
      begin
        writeln('Win!');

        readln;

        exit;
      end;
    end;
  writeln('Sorry,you loost!');

  readln;
  exit;
end;
procedure Artificial_intelligence_ai;
begin
  clrscr;
  writeln('Because we are in the experiment, so can only answer the question');
  writeln('Input the question namber,if you input 110 then go to the home p');
  writeln('age,if you input 120 then exit');
  writeln('Not have question!');
  readln(aq);
  case aq of
  110:exit;
  120:halt
  else writeln('Error!');
  end;
  exit;
end;
procedure match;
begin
  clrscr;
  writeln('You want to choose which project?(Input the number)');
  writeln('1,Shopping/error');
  writeln('2,Build the website/error');
  writeln('3,Game');
  writeln('4,Artificial intelligence ai');
  writeln('5,Exit');
  readln(aq);
  case aq of
  3:begin
    Game;
    exit;
  end;
  4:begin
    Artificial_intelligence_ai;
    exit;
  end;
  5:exit;
  else
  begin
    writeln('Error!Please input the 120 then halt else exit');
    readln(y);
    if y='120' then halt;
    exit;
  end;
  end;
end;
procedure login;
begin
  i:=1;
  while x<>a[i] do
  begin
    if i=1 then clrscr;
    gotoxy(1,2);
    writeln('Login');
    writeln('If you not have WEQ user.Please input register!');
    gotoxy(1,4);
    write('User:     ');
      readln(x);
      if x='' then login;
      if x='register' then exit;
    for i:=1 to 1000 do
    if x=a[i] then break;
    if (i=1000) and (x<>a[1000]) then
    begin
      clrscr;
      writeln('Not have the User!');
    end;
  end;
  j:=0;
  while y<>b[i] do
  begin
    write('Password(A line of a):');
    readln(y);
    if y='' then login;
    if y<>b[i] then
    begin
      clrscr;
      writeln('Password error!');
      clrscr;
      writeln('Is the jump to the homepage!......');
      exit;
    end;
  end;
  writeln('Login win!');
  clrscr;
  gotoxy(1,1);
  writeln('Enter to game!');
  match;
end;


procedure register;
begin
  clrscr;
  us:='';
  a[i]:='';
  while us=a[i] do
  begin
    ss:=ss+1;
    clrscr;
    if ss=1 then writeln
    else writeln('User alrerdy exists!');
    writeln('register');
    write('User:   ');
    readln(us);
    if us='' then register;
    for i:=1 to 1000 do
    if a[i]=us then register;
  end;
  a[i]:=us;
  i:=1;
  while a[i]<>'' do
  i:=i+1;
  a[i]:=us;
  k:=' ';
  begin
    while k<>l do
    begin
      write('Password(A line of a):');
      readln(k);
      if k='exit' then exit;
      write('Until pa(A line of a):');
      j:=0;
      readln(l);
      if k=l then break;
      clrscr;
    writeln('Passwords do not match!');
    writeln('User:    ',us);
  end;
  b[i]:=k;
  writeln('Now,let us login!Press input ok');
  readln(l);
  x:=us;
  y:=k;
  login;
  end;
end;
begin
  a[1]:='admin';
  b[1]:='admin';
  clrscr;
  while x<>'exit' do
  begin
    clrscr;
    writeln('Welcome!If input login then go to the Login page.If input register then go to the register page(If input exit then exit)');
    gotoxy(1,3);
    readln(x);
    lowercase(x);
    if x='login' then login;
    if x='register' then register;
    if x='exit' then halt;
  end;
end.

转载于:https://my.oschina.net/u/3233411/blog/828035

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值