ColdFusion

Moderators: None (Apply to moderate this forum)
Number of threads: 19
Number of posts: 30

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
This determines my future in information technology .reply promptly Posted by GHost182 on 22 Dec 2005 at 6:16 PM
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. Sba\Pascal\registernew');
assign(bfile,'F:\I.T. Sba\Pascal\borrow');
assign(rtemp,'F:\I.T. Sba\Pascal\rtemp');
assign(btemp,'F:\I.T. Sba\Pascal\btemp');
{rewrite(regfile);
rewrite(rtemp);}
SortArray(memray,regfile);
end.


Thread Tree



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.