Program Menu_Pilihan;
uses crt;
var
pilihan : byte;
S, P, LE, T, R : integer;
L, V, LP, LL, LS, LA : real;
y : string;
begin
repeat
clrscr;
writeln('=================');
writeln('MENU BANGUN RUANG');
writeln('=================');
writeln('-----------------');
writeln('1. Kubus');
writeln('2. Balok');
writeln('3. Kerucut');
writeln('4. Tabung');
writeln('0. keluar');
writeln('-----------------');
write('Pilihan anda [0-4] : '); read(pilihan);
readln;
if (pilihan < 0) or (pilihan > 4)
then
begin
write('Salah Memilih Menu, Tekan ENTER!');
end
else
begin
case (pilihan) of
1 : begin
repeat
clrscr;
writeln('====================');
writeln(' KUBUS');
writeln('====================');
write('SISI <CM> : ');read(S);
L:=6*S*S;
V:=S*S*S;
writeln('--------------------');
writeln('LUAS : ',L:0:2,' CM2');
writeln('VOLUME : ',V:0:2,' CM3');
readln;
writeln('---------------------------------------');
write('Apakah Anda Ingin Mencoba Lagi (T untuk kembali ke awal)? Y/T : ');read(y);
until y = 't'
end;
2 : begin
repeat
clrscr;
writeln('=================');
writeln(' BALOK');
writeln('=================');
write('PANJANG <CM> : ');read(P);
write('LEBAR <CM> : ');read(LE);
write('TINGGI <CM> : ');read(T);
LP:=2*(P*LE+P*T+T*LE);
V:=P*LE*T;
writeln('-----------------');
writeln('LUAS PERMUKAAN : ',LP:0:2);
writeln('VOLUME : ',V:0:2);
readln;
writeln('---------------------------------------');
write('Apakah Anda Ingin Mencoba Lagi (T untuk kembali ke awal)? Y/T : ');read(y);
until y = 't'
end;
3 : begin
repeat
clrscr;
writeln('=================');
writeln(' KERUCUT');
writeln('==================');
write('JARI-JARI <CM> : ');read(R);
write('SISI <CM> : ');read(S);
write('TINGGI <CM> : ');read(T);
LL:=3.14*R*R;
LS:=3.14*R*S;
LP:=LL+LS;
V:=1/3*3.14*R*R*T;
writeln('-----------');
writeln('LUAS LINGKARAN : ',LL:0:2);
writeln('LUAS SELIMUT : ',LS:0:2);
writeln('LUAS PERMUKAAN : ',LP:0:2);
writeln('VOLUME : ',V:0:2);
readln;
writeln('---------------------------------------');
write('Apakah Anda Ingin Mencoba Lagi (T untuk kembali ke awal)? Y/T : ');read(y);
until y = 't'
end;
4 : begin
repeat
clrscr;
writeln('=================');
writeln(' TABUNG');
writeln('=================');
write('JARI-JARI <CM> : '); read(R);
write('TINGGI <CM> : ');read(T);
LA:=3.14*R*R;
LS:=2*3.14*R*T;
LP:=2*(LA+LS);
V:=3.14*R*R*T;
writeln('------------------');
writeln('LUAS ALAS : ',LA:0:2);
writeln('LUAS SELIMUT : ',LS:0:2);
writeln('LUAS PERMUKAAN : ',LP:0:2);
writeln('VOLUME : ',V:0:2);
readln;
writeln('---------------------------------------');
write('Apakah Anda Ingin Mencoba Lagi (T untuk kembali ke awal)? Y/T : ');read(y);
until y = 't'
end;
0 : begin
clrscr;
gotoxy(3,2);
writeln('Apa Anda Yakin Ingin Keluar');
write(' dari Program ini ? [Y/T] : ');read(y);
clrscr;
write('Keluar Program....');
readln;
end;
end;
end;
readln;
until pilihan = 0
end.
No comments:
Post a Comment