| | |
Bubble Sort of a file of records in Pascal pls
![]() |
•
•
Join Date: Dec 2006
Posts: 7
Reputation:
Solved Threads: 0
hey i am trying to sort a file of records by name. Im trying to use the bubble sort but all the code i ve found is with the use of arrays. Any idea pls.
Procedure Bubble_Sort;
var
a : array [1..20] of string;
i,j : integer;
t : string;
begin
clrscr;
create_client;
for i:= 1 to Filesize(C) do
Read(C,recc);
a[i]:= recc.name;
for i := 1 to Filesize(C) do
for j := 1 to Filesize(C)-1 do
if a [j] > a[j+1] then
begin
t := a[j];
a[j] := a[j+1];
a[j+1] := t;
end;
writeln;
for i := 1 to filesize(C) do writeln(a[i]);
readln;
end;
Procedure Bubble_Sort;
var
a : array [1..20] of string;
i,j : integer;
t : string;
begin
clrscr;
create_client;
for i:= 1 to Filesize(C) do
Read(C,recc);
a[i]:= recc.name;
for i := 1 to Filesize(C) do
for j := 1 to Filesize(C)-1 do
if a [j] > a[j+1] then
begin
t := a[j];
a[j] := a[j+1];
a[j+1] := t;
end;
writeln;
for i := 1 to filesize(C) do writeln(a[i]);
readln;
end;
![]() |
Similar Threads
- How do i change this JAVA Insertion sort object to Bubble Sort object (Java)
- simplified bubble sort c++ (C++)
- Bubble sort & File output jibrish errors??? (C)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: pascal save problem
- Next Thread: Dephi 7 and magnetic strip
| Thread Tools | Search this Thread |





