• 0

Pascal : how to sort a binary file and use the seek command?


Question

i want a help i have this program

Program Assignment3 (Input,Output);
Uses
 crt;


Const
 min =   1;
 max = 200;

Type

	 cust_rec = Record
	  id		 : integer;
	  name	: string[20];
	  idnum   : integer;
	  balance : real;
	  credit  : real;
	 end;
	 filenametype=file of cust_rec;

Var
	 client		   : cust_table;
	 a,i,tmp,account  : integer;
	 purchace		 : real;
	 total			: real;
	 exit			 : boolean;
	 infile		   : filenametype;
	 outfile		  : text;



Procedure geo;

Begin
	 i:=10;
	 while (not eof(infile)) do
	   Begin
		readln(infile,i,client.name,client.idnum,client.balance,client.credit);
		write(filename,client);
	   i:=i+10;
	   end;

end;

Begin
Begin
	 Clrscr;
	 Assign(infile,'input.txt');
	 Assign(outfile,'outfile.txt');
	 Assign(filename,'test');
	 Reset(infile);
	 Rewrite(outfile);
	 Rewrite(filename);
	 geo;
	 close(infile);
	 close(outfile);
	 close(filename);
	 readln;
end.
end.

im reading from input.txt my data

Turbo Ferari		 3621 629.13 900.00
Mary Jane smith	  1183 211.18 500.00
Jim Jay Jones		4444 663.25 750.00
Elizabeth Crowley	6329 708.35 1000.00
Felicity Bowser	  9111 15.10 300.00

after i convert them to binary. After i want to sort them by the account. How i can sort data from the binary?

Question2:

After the sorting i want to use the seek command to check if the account that user input form the keyboard exist in the binary file.

Please help me!!

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.