Minggu, 06 Januari 2013

pointer dalam pascal


program pr;
uses crt;
type
Dmhs = ^Rmhs;
Rmhs = record
nm,npm,kls: string;
end;
var
mhs: array [1..5] of Rmhs;
n, i : integer;
begin
textcolor (lightblue+blink);
textbackground (lightgray);
clrscr;
write ('masukkan banyak data : ');
readln (n);
writeln;
for i:= 1 to n do
begin
write('masukkan nama ke-',i,' : ');
readln(mhs[i].nm);
write('masukkan nilai ke-',i,' : ');
readln(mhs[i].npm);
write('masukkan kelas ke-',i,' : ');
readln(mhs[i].kls);
writeln;
end;
clrscr;
for i := 1 to n do
begin
writeln('Nama ke-',i,' : ',mhs[i].nm);
writeln('nilai ke-',i,' : ',mhs[i].npm);
writeln('Kelas ke-',i,' : ',mhs[i].kls);
writeln;
end;
readkey;
end.


Tidak ada komentar:

Posting Komentar