这个程序是我刚学完Free PASCAL的语法时自己编的,现在看来有点智障,不过那时还玩的挺开心的。
拿出来分享下。
一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一
const
a1=5;
a2=10;
a3=20;
a4=50;
a5=100;
a6=500;
var
i,j,a,b,n,sum,last,first:longint;
procedure r(var sum,a,n:longint) ;
var
b:longint;
begin
n:=n+1;
sum:=sum-a;
writeln('You lose ',a,'$');
randomize;
b:=random(a*2);
writeln('You get ',b,'$');
sum:=sum+b;
if sum < a1 then
begin
writeln('Ha ha , you are too poor to play this game, and get out!');
readln;
halt;
end;
writeln('Now you have ',sum,'$');
end;
begin
writeln('THK`s game.');
for i:=1 to 10 do
begin
for j:=1 to 70 do
if j mod 2 = 0 then write('-') else write(' ');
writeln;
end;
writeln('Please write how much money do you have:');
readln(first);
writeln('Please write how much money do you want:');
readln(last);
if first < last then
begin
writeln('Ok. Game begin!');
n:=0;
sum:=first;
while sum < last do
begin
if n=0 then
begin
writeln('You want to get ',last,'$ , Now you have ',sum,'$');
writeln('You can pay ',a1,'$ ',a2,'$ ',a3,'$ ',a4,'$ ',a5,'$ ',a6,'$ to play this game, and you will get the money!');
writeln('What do you want?');
end;
readln(a);
r(sum,a,n);
end;
writeln('Excellent! You have got so much money!');
end
else writeln ('Shit!');
readln;
writeln('Please remember:THK made this game!');
readln;
end.
一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一