Universitas Teknologi Yogyakarta

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

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 is default featured post 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

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.

Selasa, 17 Mei 2011

Tugas Pemrograman Dasar (Array dan Record)

Tampilan program pada saat input data mahasiswa :



Tampilan program pada saat mencetak data :



Sintaks program Array dan Record (Program Tabel Mahasiswa):


uses wincrt; 
type recttl= record
             tmp : string[8];
             tgl : 1..31;
             bln : 1..12;
             thn : integer;
             end;
     recmhs= record
             nim  : string;
             nama : string;
             prodi: string;
             ttl  : recttl;
             nilai: real;
             end;

var i,n: integer;
    mhs: array [1..10] of recmhs;

procedure input_data; {Prosedur input data mahasiswa}
begin
for i:=1 to n do
    with mhs[i],ttl do
         begin
         writeln('Mahasiswa ',i);
         write('NIM                 :'); readln(nim);
         write('Nama                :'); readln(nama);
         write('Program studi       :'); readln(prodi);
         write('Tempat lahir        :'); readln(tmp);
         write('Tanggal lahir (1-30 :'); readln(tgl);
         write('Bulan Lahir (1-12)  :'); readln(bln);
         write('Tahun Lahir         :'); readln(thn);
         write('Nilai               :'); readln(nilai);
         writeln;
         end;
end;

{Prosedur pengurutan data berdasarkan nilai mahasiswa}
procedure urut_data; 
var tukar: recmhs;
    j    : integer;
begin
for i:=1 to n-1 do
    for j:=i+1 to n do
        if mhs[i].nilai < mhs[j].nilai then
           begin
           tukar := mhs[i];
           mhs[i]:= mhs[j];
           mhs[j]:= tukar;
           end;         
end;

{Prosedure mencetak data mahasiswa} 
procedure cetak_data;
begin
clrscr;
writeln('                Tabel Mahasiswa Universitas Teknologi Yogyakarta               ');
writeln('                  Fakultas Informations Technology and Business                ');
writeln('                       Program Studi Teknik Informattika                       ');
writeln;
writeln('_______________________________________________________________________________');
writeln('|    NIM   |        Nama        |   Program Studi  |         TTL        |Nilai|');
writeln('-------------------------------------------------------------------------------');
for i:=1 to do
    with mhs[i],ttl do
         begin
         write('|',nim:10,'|',nama:20,'|',prodi:18,'|',tmp:8,',   ',tgl:2,'/',bln:2,'/',thn:4,'|',nilai:3:2,'|');
         end;
writeln('-------------------------------------------------------------------------------');
end;

{Program utama}
begin
write('Banyaknya Mahasiswa = '); readln(n);
input_data;
urut_data;
cetak_data;
end.

Created by:
Nama               : Arifianto
NIM                : 3105111314
Prodi / Kelas    : Teknik Informatika / D