Penggunaan Record pada Turbo Pascal
uses crt;
type nilai = record
hari,tugas,umum,na : real;
end;
type mapel = record
kimia,basindo : nilai;
end;
type siswa = record
nama : string[25];
nis : string[3];
mp : mapel;
end;
var
i,n,a : byte;
student : array [1..100] of siswa;
stop : boolean;
b : string[4];
begin
stop := false;
Repeat
clrscr;
write(‘Banyak siswa : ‘); readln(n);
clrscr;
writeln(‘=======================================================================’);
writeln(‘NIS Nama Siswa Mata Pelajaran N.Hr N.Tgs N.Umum N.Akhir’);
writeln(‘———————————————————————–’);
a:=4;
for i := 1 to n do
begin
with student[i] do
begin
readln(nis);
gotoxy(6,a);
readln(nama);
with mp do
begin
gotoxy(26,a);
writeln(‘Bahasa Indonesia’);
with basindo do
begin
gotoxy(44,a);
readln(hari);
gotoxy(50,a);
readln(tugas);
gotoxy(57,a);
readln(umum);
na:=(2*hari+tugas+3*umum)/6;
gotoxy(65,a);
writeln(na:3:2);
end;
type nilai = record
hari,tugas,umum,na : real;
end;
type mapel = record
kimia,basindo : nilai;
end;
type siswa = record
nama : string[25];
nis : string[3];
mp : mapel;
end;
var
i,n,a : byte;
student : array [1..100] of siswa;
stop : boolean;
b : string[4];
begin
stop := false;
Repeat
clrscr;
write(‘Banyak siswa : ‘); readln(n);
clrscr;
writeln(‘=======================================================================’);
writeln(‘NIS Nama Siswa Mata Pelajaran N.Hr N.Tgs N.Umum N.Akhir’);
writeln(‘———————————————————————–’);
a:=4;
for i := 1 to n do
begin
with student[i] do
begin
readln(nis);
gotoxy(6,a);
readln(nama);
with mp do
begin
gotoxy(26,a);
writeln(‘Bahasa Indonesia’);
with basindo do
begin
gotoxy(44,a);
readln(hari);
gotoxy(50,a);
readln(tugas);
gotoxy(57,a);
readln(umum);
na:=(2*hari+tugas+3*umum)/6;
gotoxy(65,a);
writeln(na:3:2);
end;
Tidak ada komentar:
Posting Komentar