This determines my future in information technology .reply promptly

I am currently doing information technology in school and I need to hand in my School Based Assesment (SBA) assignment. I have done a program in which I used an array of records. I need to sort and edit the data, but so far I cannot get either one of them to work. Please help.I am required to use Turbo Pascal to do the assignment. Here is a sample of the declaraton and body of the program I have written, if it might help. I am only a begginer, so it might look a bit simple.

program librarything (input, output);
uses {win}crt;
type
memrec= record
fname:string;
lname:string;
other:string;
homeaddress:string;
form:string;
tel:char;
parent:string;
partel:char;
powork:string;
end;
brec= record
fname:string;
lname:string;
bkname:string;
duedate:string;
nowdate:string;
end;
memarray= packed array[1..20] of memrec;
memrecfile= file of memrec;
borarray= packed array[1..20] of brec;
brecfile= file of brec;
var
memray:memarray;
rtemp:memrecfile;
btemp:brecfile;
reginfo:memrec;
regfile:memrecfile;
binfo:brec;
bfile:brecfile;
size:integer;

{*************************************************************************************************}
PROCEDURE SortArray(var memray:memarray; var regfile:memrecfile);{ To sort the arrays above... I want to do them one at a time}
VAR
location,index,size:INTEGER;
current:memrec;
BEGIN
reset (regfile);
size:=1;
WHILE NOT EOF (regfile) DO
BEGIN
read(regfile,memray[size]);
size:=size+1;
END;
reset (regfile);



FOR index:= 2 TO size-1 DO
BEGIN
current:=memray[index];
location:=index;
WHILE (location > 1) AND (memray[location-1].fname < current.fname) DO
BEGIN
memray[location]:=memray[location-1];
location:=location-1;
END;
memray[location]:=current;
END;

rewrite(regfile);
FOR index:= 1 TO size-1 DO
BEGIN
write(regfile,memray[index]);
END;
reset(regfile);

END;

{*************************************************************************************************}

begin{main}
assign(regfile,'F:I.T. SbaPascal
egisternew');
assign(bfile,'F:I.T. SbaPascalorrow');
assign(rtemp,'F:I.T. SbaPascal
temp');
assign(btemp,'F:I.T. SbaPascaltemp');
{rewrite(regfile);
rewrite(rtemp);}
SortArray(memray,regfile);
end.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories