This is default featured post 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Kamis, 19 Mei 2011

''PENGGUNAAN ARRAY PADA RECORD''


{Program Nilai Mahasiswa Menggunakan Array Di Dalam Record}
Uses WinCrt ;
Type
    nilai_mahasiswa = Record
    Nim : String[9] ;
    Nama : String[25] ;
    Nilai : real ;
End ;
Var
mhs: Array[1..20] of nilai_mahasiswa;
i, j, n : integer ;
T1, T2 : String ;
T3 : real ;
Begin
Write('Banyak mahasiswa  =  ') ; ReadLn(n);
For i := 1 to n do
    Begin
    With mhs[i] do
         Begin
         Writeln('Data ke ',i);
         Write('N I M = '); ReadLn(Nim) ;
         Write('Nama  = '); ReadLn(Nama) ;
         Write('Nilai = '); ReadLn(Nilai) ;
         End ;
    End ;
     For i := 1 to n do
     Begin
      For j := i to n do
        Begin
         If mhs[i].Nim > mhs[j].Nim then
        Begin
        T1 := mhs[i].Nim ;
        mhs[i].Nim := mhs[j].Nim ;
        mhs[j].Nim := t1 ;
        T2 := mhs[i].Nama ;
        mhs[i].Nama := mhs[j].Nama ;
        mhs[j].Nama := T2 ;
        T3 := mhs[i].Nilai;
        mhs[i].Nilai := mhs[j].Nilai ;
        mhs[j].Nilai := T3 ;
        End ;
        End ;
     End ;
WriteLn('----------------------------------------------------') ;
WriteLn(' Soritng Berdasarkan N I M ') ;
WriteLn('----------------------------------------------------') ;
WriteLn('        D A T A  N I L A I  M A H A S I S W A       ') ;
WriteLn('----------------------------------------------------') ;
WriteLn('index |  N  I  M  |    NAMA MAHASISWA   | N I L A I ') ;
WriteLn('-----------------------------------------------------') ;
For i:= 1 to n do
With  mhs[i] do
Writeln('[',i:3,'] | ',Nim:9,' | ',Nama:25,' |   ',Nilai:8:0) ;
WriteLn('---------------------------------------------------') ;
End.

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites