pascal 游戏帖
pascal吧
全部回复
仅看楼主
level 5
游戏1.
var x,y,x1,y1:longint;
begin
writeln('Let us play a game!');
randomize;
x:=random(100);
y:=random(100);
writeln('x-y=',x-y);
writeln('x+y=',x+y);
write('x=');
read(x1);
write('y=');
readln(y1);
if ((x1-y1)=(x-y))and((y1+x1)=(x+y)) then
begin
writeln('You are right!');
readln;
end
else
begin
writeln('You are wrong!');
readln;
writeln('x=',x);
writeln('y=',y);
readln;
end;
end.
2014年12月24日 05点12分 1
level 5
游戏2.
program paigame(input,output);
uses crt;
var a,r,score:integer;
b:boolean;
procedure case1;
var ch:shortint;
begin
writeln('----- ----- -----');
writeln('| | | | | |');
writeln('| | | | | |');
writeln('| * | | | | |');
writeln('| | | | | |');
writeln('| | | | | |');
writeln('----- ----- -----');
writeln('Card1 Card2 Card3');
delay(300);
clrscr;
writeln('Which card is ''*''?');
readln(choose);
if choose=1 then begin writeln('Good!Score+10.'); score:=score+10; readln; b:=true; end
else begin writeln('Oops!The right one is Card1!Game over.'); readln; end;
end;
procedure case2;
var ch:shortint;
begin
writeln('----- ----- -----');
writeln('| | | | | |');
writeln('| | | | | |');
writeln('| | | * | | |');
writeln('| | | | | |');
writeln('| | | | | |');
writeln('----- ----- -----');
writeln('Card1 Card2 Card3');
delay(300);
clrscr;
writeln('Which card is ''*''?');
readln(choose);
if choose=1 then begin writeln('Good!Score+10.'); score:=score+10; readln; b:=true; end
else begin writeln('Oops!The right one is Card2!Game over.'); readln; end;
end;
procedure case3;
var ch:shortint;
begin
writeln('----- ----- -----');
writeln('| | | | | |');
writeln('| | | | | |');
writeln('| | | | | * |');
writeln('| | | | | |');
writeln('| | | | | |');
writeln('----- ----- -----');
writeln('Card1 Card2 Card3');
delay(300);
clrscr;
writeln('Which card is ''*''?');
readln(choose);
if choose=1 then begin writeln('Good!Score+10.'); score:=score+10; readln; b:=true; end
else begin writeln('Oops!The right one is Card2!Game over.'); readln; end;
end;
begin
b:=true;
while b=true do
begin
b=false;
writeln('Press Enter key to begin...');
readln;
write('Ready?')
delay(200);
writeln(' Go!');
delay(100);
clrscr;
r:=trunc(random*2)+1;
case r of
1:case1;
2:case2;
3:case3;
end;
end;
writeln('Your score:',score);
writeln('Thanks for playing!Press Enter key to exit.');
readln;
end.
2014年12月24日 05点12分 2
怎么可能?
2014年12月26日 04点12分
level 1
请问袁健聪的屁股直径的程序怎么编??
2014年12月24日 05点12分 4
var n,i,j,k,s:longint; begin for i:=1 to 100 do if i mod 2=1 then k:=k+100; writeln(k); readln; end.
2014年12月24日 05点12分
谢谢[钱币]
2014年12月24日 05点12分
level 5
var n,i,j,k,s:longint;
begin
for i:=1 to 100 do
if i mod 2=1 then
k:=k+100;
writeln(k);
readln;
end.
2014年12月24日 05点12分 5
好东西,袁健聪的屁股真大[哈哈]
2014年12月24日 05点12分
level 4
果然mc和pa有莫大联系
2014年12月24日 07点12分 6
你怎么知道???原因何在???节操何在???
2014年12月24日 08点12分
level 1
如果实在答不不出来,那把贪吃蛇1.0.0和1.0.1给我吧!
2014年12月24日 09点12分 9
level 5
不可能
2014年12月24日 09点12分 10
level 5
var n,i,j,k,s:Longint;
begin
read(n);
for i:=1 to n do
j:=i mod 2;
if j=2 then
k:=k+5;
writeln(k);
end.
2014年12月24日 09点12分 11
level 1
求您真名/生日/星座/qq/家住地址。
2014年12月24日 09点12分 12
level 5
风伯 神秘 王 无 舞秋风之家
2014年12月24日 09点12分 13
level 1
那你
2014年12月24日 09点12分 14
level 5
楼主,我
2014年12月25日 04点12分 15
1