Sunday, 3 August 2014

Program Queue (antrian) sederhana dalam pascal

Program Queue (antrian) sederhana dalam pascal

uses crt;

const

max=3;

type

A= array[1..max]of string;

var

antrian :A;
no_antri :0..max;
tanya :char;

begin

clrscr;

writeln(' PROGRAM ANTRIAN SEDERHANA ');
writeln('=========================================');
tanya:='Y';
while tanya in['Y','y'] do

begin

write('Elemen ke-1 =');readln(antrian[1]);
no_antri:=no_antri+1;
write('Elemen ke-2 =');readln(antrian[2]);
no_antri:=no_antri+1;
write('Elemen ke-3 =');readln(antrian[3]);
no_antri:=no_antri+1;
writeln;
writeln('Tampilan = ',antrian[1],' ',antrian[2],' ',antrian[3]);
writeln('Jumlah antrian =',no_antri);
writeln('--------------------------------------------');

readln;

write('Akan tambah data?[Y/T]');readln(tanya);

end;

writeln('Jumlah elemen dalam antrian =',no_antri);

readln;

end.

No comments:
Write komentar