Uses crt;
Type
simpul = ^data;
data = record
bilangan : integer;
next : simpul;
end;

var awal,akhir,baru,bantu : simpul;

procedure sisip_depan;
begin
new(baru);
write (‘Masukkan Bilangan : ‘);
readln (baru^.bilangan);
if awal=nil then
begin
baru^.next:=nil;
awal:=baru;
akhir:=baru;
end
else
begin
baru^.next:=awal;
awal:=baru;
end;
end;

procedure tampil;
begin
bantu:=awal;
while (bantu<>nil) do
begin
writeln(bantu^.bilangan);
bantu:=bantu^.next;
end;
end;
begin
awal:=nil;
akhir:=nil;
sisip_depan;
sisip_depan;
sisip_depan;
tampil;
readln;
end.

Tags: ,