Buat teman-teman yang suka program rubo pascal atau yang dalam menjalani yang berhubungan dengan turbo pascal silahkan download dulu aplikasinya disini admin akan memberikan contoh program pascal yaitu record data. Silahkan perhatikan kodingan berikut
Contoh Program Record
uses crt;
type mhs = record
nama:string[15];
nim:string[9];
nilai:integer;
end;
var dtmhs:array [1..100] of mhs;
i,n:integer;
grade:char;
procedure input;
begin
clrscr;
write('Masukkan Jumlah Data : '); readln(n);
clrscr;
for i:=1 to n do
with dtmhs[i] do
begin
writeln('Data ke-',i);
write('Nama : '); readln(nama);
write('NIM : '); readln(nim);
write('Nilai : '); readln(nilai);
writeln;
end;
readkey;
end;
procedure output;
begin
clrscr;
writeln(' __________________________________________________');
writeln('| NO | NIM | NAMA | NILAI | GRADE |');
writeln('|--------------------------------------------------|');
writeln('| | | | | |');
for i:=1 to n do
with dtmhs[i] do
begin
writeln('| | | | | |');
gotoxy(3,i+3); writeln(i);
gotoxy(8,i+3); writeln(nim);
gotoxy(20,i+3); writeln(nama);
gotoxy(38,i+3); writeln(nilai);
if nilai<50 then grade:='E';
if nilai>=50 then grade:='D';
if nilai>=60 then grade:='C';
if nilai>=70 then grade:='B';
if nilai>=80 then grade:='A';
gotoxy(46,i+3); writeln(grade);
end;
writeln('|__________________________________________________|');
readkey;
end;
{Program Utama}
begin
input;
output;
end.
Perhatikan lagi kodingannya teman-teman jika ada yang mau diganti. Silahkan kalau mau berbagi
Post a Comment