Program Record Pascal

Posted on Updated on


Minggu ke                  : 6

Nama program          : Program record

Fungsi                         :

  • Menggunakan record pada pemrograman pascal

Listing Program        :

uses crt;

type mahasiswa = RECORD

NPM     : String;

Nama    : String;

Thnmasuk: Integer;

ket     : String;

end;

var

mhs : Array[1..50] of mahasiswa;

x,y,z:Integer;

begin

clrscr;

writeln(‘————————————————‘);

writeln(‘                  PROGRAM RECORD                ‘);

writeln(‘————————————————‘);

write  (‘ banyak data mahasiswa yang akan dimasukkan: ‘);

readln (x);

writeln();

for y:=1 to x do

begin

with mhs[y] do

begin

write(‘ NPM mahasiswa   : ‘);

readln(NPM);

write(‘ Nama mahasiswa  : ‘);

readln(Nama);

write(‘ Tahun masuk     : ‘);

readln(Thnmasuk);

writeln();

end;

end;

clrscr;

writeln();

writeln(‘                        DAFTAR NAMA MAHASISWA                        ‘);

writeln(‘———————————————————————-‘);

writeln(‘| NO |    NPM    |           NAMA           |  TAHUN MASUK |    KET  |’);

writeln(‘———————————————————————-‘);

for y:=1 to x do

begin

gotoxy(1,y+5);write(‘|’);

gotoxy(3,y+5);write(y);

with mhs[y] do

begin

gotoxy(6,y+5);write(‘|’);

gotoxy(8,y+5);

write(NPM);

gotoxy(18,y+5);write(‘|’);

gotoxy(20,y+5);

write(Nama);

gotoxy(45,y+5);write(‘|’);

gotoxy(51,y+5);

write(Thnmasuk);

gotoxy(60,y+5);write(‘|’);

z := 2010 – Thnmasuk;

if z>3 then ket := ‘senior’ else

ket:=’junior’;

gotoxy(63,y+5);

write(ket);

gotoxy(70,y+5);write(‘|’);

end;

end;

writeln();

writeln(‘———————————————————————-‘);

readln;

end.

Output program:

tampilan program saat input data

menampilkan data record



Web development jakarta

2 thoughts on “Program Record Pascal

    Rizal said:
    Agustus 11, 2013 pukul 4:20 am

    ilmu baru, thx sharingnya

    novita said:
    Maret 26, 2015 pukul 11:26 am

    Makasih banget niiih.ngebantu tugas banget dehhh hihi^^

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s