PROGRAM
Tebakangka;
USES
wincrt;
VAR
i,a,b,c,d,max : integer;
MenuUtama : integer;
angka_random : integer;
tebakan : boolean;
angka_input : integer;
MenuPengaturan : integer;
KesempatanTebak : integer;
RangeRandom : integer;
score : integer;
BEGIN
randomize;
KesempatanTebak := 6;
RangeRandom := 10;
Repeat
clrscr;
gotoxy(25,3); writeln('****************************');
gotoxy(25,4); writeln('| PROGRAM TEBAK ANGKA |');
gotoxy(25,5); writeln('****************************');
WRITELN;
gotoxy(25,7); writeln('1. Play');
gotoxy(25,8); writeln('2. Pengaturan');
gotoxy(25,9); writeln('3. Kelompok');
gotoxy(25,10); writeln('4. Exit');
writeln;
gotoxy(25,12); write('Menu Pilihan Anda : ') ;
readln(MenuUtama);
case MenuUtama of
1 : Begin
clrscr;
angka_random := random(RangeRandom);
tebakan := false;
i := 1;
while (tebakan = false) and (i <= KesempatanTebak) do
Begin
Write('silahkan tebak angka berapa = ');
readln(angka_input);
if angka_input > angka_random then
writeln('Tebakan Terlalu Besar')
else if angka_input < angka_random then
writeln('Tebakan Terlalu Kecil')
else
Begin
writeln('Tebakan Benar');
tebakan := true;
score := 100 div i;
writeln('Nilai Anda = ', score);
readln;
End;
i := i + 1;
End;
if i > KesempatanTebak then
Begin
writeln('You Lose...!!!') ;
readln;
End;
End;
2 : Begin
clrscr;
repeat
clrscr;
gotoxy(25,3); writeln('**************************');
gotoxy(25,4); writeln(' | Menu Pengaturan |');
gotoxy(25,5); writeln('**************************');
writeln;
gotoxy(25,7);writeln('1. MUDAH');
gotoxy(25,8);writeln('2. NORMAL');
gotoxy(25,9);writeln('3. SUSAH');
gotoxy(25,10);writeln('4. Skor tertinggi');
gotoxy(25,11);writeln('5. Kembali') ;
writeln;
gotoxy(25,13);write('Pilih Level : ') ;
readln(MenuPengaturan);
case MenuPengaturan of
1 : BEGIN
KesempatanTebak := 6;
RangeRandom := 10;
gotoxy(25,15);Writeln(' LEVEL MUDAH ');
gotoxy(25,16);Writeln(' Tebak Dari 1 s/d 10 ');
readln;
END;
2 : BEGIN
KesempatanTebak := 4;
RangeRandom := 50;
gotoxy(25,15);Writeln(' LEVEL NORMAL ');
gotoxy(25,16);Writeln('Tebak Dari 1 s/d 50 ');
readln;
END;
3 : BEGIN
KesempatanTebak := 2;
RangeRandom := 100;
gotoxy(25,15);Writeln(' LEVEL SUSAH ');
gotoxy(25,16);Writeln('Tebak Dari 1 s/d 100 ');
readln;
END;
4 : begin
repeat
clrscr;
gotoxy(25,5);writeln('Skor tertinggi');
gotoxy(25,6);writeln('1.MUDAH ');
gotoxy(25,7);writeln('2.NORMAL ');
gotoxy(25,8);writeln('3.SUSAH');
gotoxy(25,9);writeln('4.kembali ');
gotoxy(25,11);write('inputkan yg anda inginkan :');
readln(MenuUtama);
case MenuUtama of
1 :begin
if tebakan=true then
begin
a:= 0;
gotoxy(25,12); write('skor tertinggi = ',score);
end;
end;
2 :begin
if tebakan=true then
begin
b:=0;
gotoxy(25,12);write('skor tertinggi = ',score);
end;
end;
3 :begin
if tebakan=true then
begin
c:=0;
gotoxy(25,12); write('skor tertinggi = ',score);
end;
end;
4 : BEGIN
writeln('Kembali Ke Menu Utama');
END;
end;
readln;
until MenuUtama = 4 ;
end;
5 : BEGIN
writeln('Kembali Ke Menu Utama');
END;
else
Begin
writeln('Salah Menu');
end;
end;
until MenuPengaturan = 5;
End;
3 : Begin
clrscr;
gotoxy(25,5);writeln('Kelompok 4 ');
gotoxy(25,6);writeln('1. Agus Supriyanto');
gotoxy(25,7);writeln('2. Adib Mustofa');
gotoxy(25,8);writeln('3. Ali Moch.Kunevi');
gotoxy(25,9);writeln('4. Ade kenrian');
gotoxy(25,10);writeln('5. Ali Imron');
gotoxy(25,12);write('Tekan Enter Untuk Kembali');
readln;
End;
4 : Begin
gotoxy(25,15);writeln('Permainan Selesai...@_@');
readln;
End;
else
Begin
gotoxy(25,15);write('Pilihan Salah...!!!');
readln;
end;
end;
Until MenuUtama = 4;
END.
Tidak ada komentar:
Posting Komentar