Senin, 13 April 2015

Pointer Tak Bertipe

Assalamu'alaikum wr. wb.
Alhamdulillahirobbil'alamin
Program kelima Algoritma & Pemrograman II Selesai
1. Screen Shot Program
Gambar 1.1 Tampilan Program PointerTT yaituinput jumlah data dan output muncul.
2. Source Code Program
Program PointerTT;
uses crt;
var
ptr : Pointer;
q   : ^byte;
r   : array [0..50] of Byte;
i,n : integer;

BEGIN
 clrscr;
 GetMem(ptr, 20);
 q := ptr;
 writeln('Pointer Tidak Bertipe');
 writeln('~~~~~~~~~~~~~~~~~~~~~');
 writeln;
 write  ('Input jumlah data : '); readln(n);
 writeln;
 for i := 1 to n do
  begin
   r[i] := n - i ;
   q^   := n - i;
   inc(q);
  end;

 q := ptr;
 for i := 1 to n do
  begin
   write  ('r[',i,'] = ',r[i],' ;    ');
   writeln('ptr^ ke-',i,' = ',q^);
   inc(q);
  end;
  readln;
end.

0 komentar :

Posting Komentar