Contoh Program Stack Pascal

Pascal

In data structure: program of stack by Pascal programming language. Article 2: The Stack Data Structure. An array is a data structure which stores data items in a pre-allocated space. It allows you to store data anywhere within its range. On the other hand, the Stack Data Structure does not allow you to store data where you want i.e. Order is important. It is based on a LIFO basis - the last to arrive, the. Membuat Program Stack Menggunakan Pascal. 23 April 2015 23 April 2015 Sadu Merta Adi. 1.Buatlah algoritma inisialisasi, push, pop, isfull, isempty.

Contoh Program Stack Pascal 1

ContohContoh program stack pascal dan

Contoh Program Stack Sederhana Pada Pascal

Dibawah ini ada contoh program sederhana dengan turbo pascal windows.
Program AnimasiStack;
Uses wincrt;
const
max = 10;
var
top,i : byte;
pil,tem,E : char;
stack : array [1..max] of char;
procedure pushanim;
begin
for i :=1 to 18 do
begin
gotoxy(23+i,7); write(tem);
{Delay(30);}
gotoxy(23,7); clreol;
end;
for i:=1 to 14-top do
begin
{delay(30);}
gotoxy(41,6+i); write(' ');
gotoxy(41,7+i); write(tem);
end;
end;
procedure popanim(tem:char);
begin
for i:=1 to 14-top do
begin
{delay(30);}
gotoxy(41,22-i-top); write(' ');
gotoxy(41,21-i-top); write(tem);
end;
for i:=1 to 19 do
begin
gotoxy(40+i,7); write(tem);
{delay(30);}
gotoxy(16,7); clreol;
end;
end;
procedure push(e:char);
begin
inc(top);
stack[top] :=e;
pushanim;
end;
procedure pop(e:char);
begin
if top<> 0 then
begin
E:=stack[top];popanim(e);
dec(top);
end else
begin
gotoxy(1,7); write('stack telah kosong');
readkey;
gotoxy(1,7); clreol;
end;
end;
begin
clrscr;
writeln('ANIMASI STACK');
writeln('1. PUSH');
writeln('2. POP');
writeln('3. QUIT');
writeln('Pilihan anda[1/2/3] = ');
gotoxy(49,6);write(');
gotoxy(49,8);write('/');
gotoxy(37,10);write(' /');
for i:=1 to 11 do
begin
gotoxy(38,10+i);
if i=11 then write('|_____|')else write
('| |');
end;
top := 0;
repeat
gotoxy(23,5);clreol;
pil := readkey;write(pil);
if pil ='1' then
begin
if top<> max then
begin
gotoxy(1,7);write('Masukkan satu Huruf = ');
tem := readkey;write(tem);
push(tem);
gotoxy(1,7);clreol;
end else
begin
gotoxy(1,7);write('Stack sudah penuh');readkey;
gotoxy(1,7);clreol;
end;
end else
if pil='2' then pop(tem);
until pil='3';
end.
Download file
Tags: Program pascal, stack pascal.