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 selection 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
selection.pas
Program Selection_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('Selection 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],' ');
{============ Selection Sort Ascending Order ===================}
For a:=1 to num-1 do
begin
Min:=a;
For b:= a to num do
begin
If list_items[b] < list_items[min] then
Min:=b;
End;
Temp:=list_items[a];
list_items[a]:=list_items[min];
list_items[min]:=temp;
End;
writeln;
writeln;
writeln('Arrangement of Values Using Selection Sort ');
writeln;
for a := 1 to num do
begin
write(list_items[a],' ');
end;
writeln;
writeln;
write('End of Program');
writeln;
readln;
End.