contoh program record pada pascal

rogram contoh_rekaman;
uses crt;

type mhs = record
nim: string[8];
nama: string[30];
usia: byte;
jml_saudara: 0..20;
end;
var siswa : array[1..20] of mhs;
i, n : integer;
begin
clrscr;
write(‘Banyak data yang akan dimasukkan : ‘); readln(n);

{langkah pemasukan data}

for i:= 1 to n do
begin
clrscr;
writeln(‘Data ke : ‘,i);
with siswa[i] do
begin write(‘ NIM : ‘);readln(nim);
write(‘NAMA : ‘);readln(nama);
write(‘USIA : ‘);readln(usia);
write(‘SAUDARA : ‘);readln(jml_saudara);
end;
end;

{penampilan data}

clrscr;
writeln(‘DATA YANG ANDA MASUKKAN ‘);
writeln;
for i:= 1 to n do
begin
write(siswa[i].nim:11);
write(siswa[i].nama:23);
write(siswa[i].usia:5);
write(siswa[i].jml_saudara:5);
writeln;
end;
readln;
end.

sumber : http://khabib.staff.ugm.ac.id/index.php?option=com_content&view=article&id=83:rekaman-record&catid=28:introduction-to-algorithm-and-programming&Itemid=33

This entry was posted on Selasa, 09 November 2010. You can follow any responses to this entry through the RSS 2.0. You can leave a response.

Leave a Reply