Sabtu, 23 Mei 2015

pascal pointer

program pointer;
Uses crt;
Type ptr = ^string;
Var
  ptrnama, ptrjrs, ptrnim : ptr; nama,jrs,nim : string; x,n : integer;
begin
clrscr;
  writeln('data mahasiswa : ');
  writeln(' ');
  writeln('masukan angka : ');
  readln (n);
  for x := 1 to n do
  begin writeln('data ke ',x);
   writeln;
   write('Nama = ');
   readln(nama);
   write('Jurusan = ');
   readln(jrs);
   write('nim = ');
   readln(nim);
   ptrnama := @nama;
   ptrjrs := @jrs;
   ptrnim := @nim;
   writeln('nama = ',ptrnama^,'; jurusan = ',ptrjrs^,'; nim = ',ptrnim^);
  end;
readln;
end.

Tidak ada komentar:

Posting Komentar