Cari Blog Ini

Protected by Copyscape Online Copyright Protection Software

Program Record Pascal

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
 

0 komentar:

Posting Komentar

_CaesarVraseaC_



ALIHKAN MOUSE ANDA,,MAKA AKAN KEMBALI SEPERTI SEMULA !!

wibiya widget

Ilmu Komputer

Ilmu Komputer

script src='http://sites.google.com/site/gudangfathur/kode/rainbowlink.js'/>