Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
program project1;
uses SysUtils;
const
cherry = '&';
lemon = '@';
bell = '%';
orange = 'O';
star = '*';
skull = '#';
var
answer : string;
symbol1, symbol2, symbol3 : integer;
credit : real;
begin
randomize;
credit := 1;
while credit >= 0.2 do
begin
symbol1 := random(5);
symbol2 := random(5);
symbol3 := random(5);
writeln('Credits: ', FloatToStr(credit));
credit := credit - 0.2;
readln();
writeln('---------Welcome to the Fruit Machine----------');
writeln('Cherry = ', cherry);
writeln('Lemon = ', lemon);
writeln('Bell = ', bell);
writeln('Orange = ',orange);
writeln('Star = ',star);
writeln('Skull = ',skull);
writeln('');
if symbol1 = 0 then
write(' '+cherry+' ');
if symbol1 = 1 then
write(' '+lemon+' ');
if symbol1 = 2 then
write(' '+bell+' ');
if symbol1 = 3 then
write(' '+orange+' ');
if symbol1 = 4 then
write(' '+star+' ');
if symbol1 = 5 then
write(' '+skull+' ');
if symbol2 = 0 then
write(' '+cherry+' ');
if symbol2 = 1 then
write(' '+lemon+' ');
if symbol2 = 2 then
write(' '+bell+' ');
if symbol2 = 3 then
write(' '+orange+' ');
if symbol2 = 4 then
write(' '+star+' ');
if symbol2 = 5 then
write(' '+skull+' ');
if symbol3 = 0 then
write(' '+cherry+' ');
if symbol3 = 1 then
write(' '+lemon+' ');
if symbol3 = 2 then
write(' '+bell+' ');
if symbol3 = 3 then
write(' '+orange+' ');
if symbol3 = 4 then
write(' '+star+' ');
if symbol3 = 5 then
write(' '+skull+' ');
if (symbol1 = symbol2) and (symbol2 = symbol3) then
begin;
credit := credit + 1;
end;
writeln('Do you want to quit? Y/N');
if answer = 'Y' then
exit
else
end;
readln;
end.
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more