Instruksi Program, Gunakan Free Pascal.
uses crt;
type
mhs = record
nama : string[20];
npm : string[8];
kelas: string[5];
uts : integer;
uas : integer;
total: real;
end;
var
i,j,b: integer;
a : array [1..10] of mhs;
pil,key,index : char;
begin
index:='y';
while (index='y') or ( index='Y') do
begin
clrscr;
textcolor(10);
writeln('-----------------***---------------');
writeln('Menu : ');
writeln('1. Inputan');
writeln('2. Bentuk');
writeln('3. X-it');
writeln('-----------------------------------');
write('Masukan pilihan = ');
readln(pil);
case pil of
'1' :
begin
textcolor(10);
writeln('-----------------------------------');
write('masukan banyak data :');
readln(b);
for i := 1 to b do
begin
with a[i] do
begin
writeln('-----------------------------------');
writeln('data ke-',i);
writeln('-----------------------------------');
write('masukan nama : ');
readln(nama);
write('masukan npm : ');
readln(npm);
write('masukan kelas : ');
readln(kelas);
writeln('-----------------------------------');
write('uts : ');
readln(uts);
write('uas : ');
readln(uas);
total:=((0.3*uas)+(0.7*uas));
writeln('-----------------------------------');
end;
clrscr;
end;
clrscr;
textcolor(10);
writeln('-----------------------------------');
write('mau cetak data ke berapa ?? ');
readln(i);
with a[i] do
begin
writeln('-----------------------------------');
writeln('nama : ',nama);
writeln('npm : ',npm);
writeln('kelas : ',kelas);
writeln('uts : ',uts);
writeln('uas : ',uas);
writeln('total : ',total);
writeln('-----------------------------------');
end;
readln;
end;
'2' :
begin
textcolor(10);
writeln('-----------------------------------');
write('masukan banyak baris :');
readln(b);
writeln('-----------------------------------');
clrscr;
writeln('-----------------------------------');
for i := 1 to b do
begin
for j := 1 to i do
begin
write(' * ');
delay(5000);
end;
writeln;
end;
writeln('-----------------------------------');
readln;
end;
'3' :
begin
textcolor(10);
writeln('-----------------------------------');
write('yakin mau keluar ?? (y/t) / (Y/T) : ');
readln(key);
if (key='y') or (key='Y') then
begin
index:='T'
end
else
index:='Y'
end;
end;
end;
writeln('good bye....');
readln;
end.
Output :
silahkan mencobanya sendiri, ini merupakan program record terdapat 3 menu inputan yang akan diisikan agar diperoleh hasil akhirnya adalah piramida dalam bentuk, namun jika menginginkan angka anda dapat mengganti beberapa simbol bintang diatas dengan angka.
0 komentar:
Posting Komentar