Sabtu, 01 Desember 2012
CONTOH PENGGUNAAN ARRAY PADA PASCAL
program array_warnet;
uses crt;
const max=50;
type
Twarnet = record
NAMA : string [25] ;
KOMPI : string [8] ;
JAM : array [1..2] of real;
end;
Tkumpulanwarnet = array[1..max] of Twarnet;
var
A : Tkumpulanwarnet;
i,N: Integer;
NA: real;
durasi:real;
begin
clrscr;
writeln ('=====> PROGRAM DATA WARNET <=====');
writeln ('---------------------------------');
write ('Masukan Data yg ingin diisikan :');
readln(N);
writeln ;
writeln ('=+=+ MASUKAN DATA ANDA +=+= ');
writeln ('---------------------------');
for i:= 1 to N do begin
writeln('Data Pengunjung ke-',i);
with A[i] do begin
write ('NAMA :'); readln(NAMA);
write ('Komputer : KE-'); readln(KOMPI);
write ('Mulai Jam : '); readln(JAM[1]);
write ('Selsai Jam : '); readln(JAM[2]);
end;
writeln;
end;
writeln('Menampilkan Data');
writeln('------------------------------------');
writeln('NAMA':5,'':2, 'KOMPI':2, '':2,'BAYAR');
writeln('------------------------------------');
for i:=1 to N do begin
with A[i] do begin
NA:= (JAM[1]*JAM[2])/2 ;
write(NAMA:5, '':2, KOMPI:2, '' :3, NA:0:3);
end;
writeln;
end;
readln;
end.
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar