A program that I wrote using Pascal as my programming language that will ask the user how many items to be sorted and then our program will display the original arrangement of the numbers and finally it will display the sorted arrangement of numbers on our screen. I am using bubble sort algorithm to sort the given numbers by our user. I am using Turbo Pascal for Windows as my programming environment. I hope you will find my work useful. Thank you.
I am currently accepting programming work kindly contact me in the following email address for further details. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
bubble.pas
Program Bubble_Sort;
uses Wincrt;
const
items = 100;
type
values = array[1..items] of integer;
var
num,a,b : integer;
list_items : values;
min : integer;
temp : integer;
Begin
writeln;
writeln('Bubble Sort Program in Turbo Pascal');
writeln;
writeln;
writeln('Written By: Mr. Jake R. Pomperada');
writeln;
write('How many items ? ');
readln(num);
for a:= 1 to num do
begin
write('Give value in item number ',a,' : ');
read(list_items[a]);
end;
writeln;
writeln;
writeln('Orignal Arrangement of Values : ');
writeln;
for a:=1 to num do
write(list_items[a],' ');
{============ Bubble Sort Ascending Order ===================}
for a:=1 to num-1 do
begin
for b:= num downto a+1 do
begin
if list_items[b] < list_items[b-1] then
begin
Temp:=list_items[b];
list_items[b]:=list_items[b-1];
list_items[b-1]:=temp;
end;
end;
end;
writeln;
writeln;
writeln('Arrangement of Values Using Bubble Sort ');
writeln;
for a := 1 to num do
begin
write(list_items[a],' ');
end;
writeln;
writeln;
write('End of Program');
writeln;
readln;
End.