Program Pointer Pada
Pascal
uses
crt;
type
ptr = ^string;
var
ptrNama,
ptrKLS, ptrNIS : ptr;
Nama,
KLS, NIS: string;
x,n
: integer;
begin
clrscr;
writeln('Data
Siswa:');
writeln('');
writeln('Masukan
Angka:');
readln
(n);
for
x := 1 to n do
begin
writeln('Data
Ke = ',x);
write('Nama
=');
readln(Nama);
write('Kelas=');
readln(KLS);
write('NIS=');
readln(NIS);
ptrNama
:= @Nama;
ptrKLS
:= @KLS;
ptrNIS
:= @NIS;
writeln('Nama
=',ptrNama^);
writeln('Kelas
=',ptrKLS^);
writeln('NIS
=',ptrNIS^);
end;
readln;
Tidak ada komentar:
Posting Komentar