Home » » Program Pencarian Nilai

Program Pencarian Nilai

Written By Unknown on Kamis, 08 November 2012 | 22.47


          Andri Muchsin
        *******************


            Program Pencarian_Nilai;
            Uses Wincrt;
            Type
                   Ptrsimpul = ^simpul;
                   Simpul = record
                   NIM : String [15];
                   Nama : string[15];
                   Next : ptrsimpul;
            End;
            Var
                   Pertama, baru, ptrdata : ptrsimpul;
                   X , y, cari : string[25];
                   ketemu : Boolean;
            Begin
            Repeat
                   Write (‘Masukkan NIM = ‘); readln(x);
                    If x <> ‘0’ then
                    Begin
                        Write(‘Masukkan Nama = ‘);readln(y);
                        Writeln;
                        New(baru);
                        Baru^.nim := x;
                        Baru^.nama := y;
                        Baru^.next := pertama;
                        Pertama := baru;
                    End;
            Until x = ‘0’;
            Writeln;
            Writeln;          
            Clrscr;
            Writeln;
            Writeln(‘Data Mahasiswa’);
            Ptrdata := pertama;
            while pertama <> nil do
            Begin
                        Writeln(pertama^.nim,’’,pertama^.nama,’’);
                        Pertama := pertama^.next;
            End;
            Writeln;
            Writeln;
            Writeln(‘Masukkan NIM yang dicari = ‘);readln(cari);
                Ketemu := false;
                While(ptrdata <> nil) and (not ketemu) do
                Begin
                        Writeln;
                        If ptrdata^.nim = cari then
                        Begin
                             Writeln;


                            Writeln(‘Data yang dicari : ‘);
                            Writeln(‘NIP :’,ptrdata^.nim,’’);
                            Writeln(‘nama :’,ptrdata^.nama,’’);
                        Writeln;
                        Ketemu := true;
                        End
                        Else
                        Ptrdata := ptrdata^.next;
                        End;
                        Begin
                        If not ketemu then
                        Write(‘Data tidak ditemukan’);
            End;
            End.




           

Share this article :

0 komentar:

Posting Komentar

Terimakasih Telah membaca artikel kami. Silahkan tinggalkan komentar anda disini.

 
Support : Dunia Matematika | Dunia Fisik dan Fiksi
Copyright © 2013. Blog Berbagi Ilmu - All Rights Reserved
Template Created by AM Published by Aeroplane
Proudly powered by Blogger