0% found this document useful (0 votes)
21 views

Program Sanarai

The document describes a linked list program in Pascal. It defines a record data type for the linked list nodes with fields for name, address, and a pointer to the next node. It includes procedures to add a new node to the end of the list, read through and display the list, and open/close screens. The main program prompts the user to input a name and address, adds it to the linked list, displays the list, and repeats until the user exits.

Uploaded by

Komang Yogi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Program Sanarai

The document describes a linked list program in Pascal. It defines a record data type for the linked list nodes with fields for name, address, and a pointer to the next node. It includes procedures to add a new node to the end of the list, read through and display the list, and open/close screens. The main program prompts the user to input a name and address, adds it to the linked list, displays the list, and repeats until the user exits.

Uploaded by

Komang Yogi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

Program sanarai_berantai; uses wincrt; type simpul = ^data; data = record nama: string[50]; alamat: string[100]; berikut: simpul;

end; var awal,akhir: simpul; d1,d2: string; a : shortint; procedure tambah_belakang (var awal,akhir:simpul; d1,d2:string); var baru: simpul; begin new(baru); baru^.nama:=d1; baru^.alamat:=d2; baru^.berikut:= nil; if awal= nil then awal:= baru else akhir^.berikut:=baru; akhir:=baru; end; procedure baca_maju(awal:simpul); var bantu: simpul; begin bantu := awal; while (bantu<>nil) do begin writeln; writeln; write(' Nama : ',bantu^.nama); writeln; write(' Alamat : ',bantu^.alamat); bantu := bantu^.berikut; end; writeln; end;

procedure delay; var J:longint; begin for j:=1 to 3200000 do begin end; end; procedure pembukaan; var i,j,h,l,F: integer; begin for l:= 2 to 14 do begin gotoxy(l,3);writeln(' I KM YOGI TRISNA ADI'); gotoxy(l,3);writeln(' '); delay; delay; delay; delay; end; for J:= 1 to 100 do begin delay; gotoxy(j,5);writeln('-'); gotoxy(j,6);writeln('-'); gotoxy(j,7);writeln('-'); gotoxy(j,8);writeln('-'); gotoxy(j,9);writeln('-'); gotoxy(j,10);writeln('-'); gotoxy(j,11);writeln('-'); end; gotoxy(14,13);writeln('loading'); for i:= 1 to 18 do begin gotoxy(13+i,15);write('*'); delay; delay; end; for h:=19 to 35 do begin gotoxy(13+h,15);write('*'); delay; delay; delay; delay;

end; for f:= 36 to 55 do begin gotoxy(13+f,15);write('*'); delay;delay; delay;delay; delay; delay; end; writeln(''); delay; delay; gotoxy(14,17);writeln('press any key to continue'); gotoxy(14,18);readkey; end; procedure tutup; var i : integer; begin for i:= 1 to 65 do begin delay; delay; delay; gotoxy(i,15);writeln(' TERIMA KASIH'); end; end; begin pembukaan; repeat clrscr; writeln; writeln(' ------ {Senarai Tunggal} ------'); writeln; repeat clreol; write('Input Nama: '); readln(d1); if d1='' then begin writeln('Harap isi data dengan benar!'); writeln; a:=0; end else a:=1; until a=1;

repeat write('Input Alamat: '); readln(d2); if d2='' then begin writeln('Harap isi data dengan benar!'); writeln; a:=0; end else a:=1; until a=1; writeln; write('Data yang tersimpan : '); tambah_belakang(awal,akhir,d1,d2); baca_maju(awal); writeln; writeln('Tekan X untuk keluar!'); until upcase(readkey)='X'; clrscr; tutup; donewincrt; end.

Hasilnya;

STRUKTUR DATA

NAMA NIM

: I KM YOGI TRISNA ADI : 0819451001

FAKULTAS TEKNIK UNIVERSITAS UDAYANA DENPASAR 2010

You might also like