I have my new Pascal assignment due Wednesday.
Assignment : I have to READ in 2 data files. File 1 has 30 'Y' or 'N' and is the customer requests for the apartment. The second file has 5 line and each line has 30 'Y' or 'N' followed by an address. The goal is to read in the files and match up the customer with the best apartment by how many Yes's match and print out the address with it.
For this assignment I must use an Array. The problem that I have is not a programing issue (yet), but this is the first project that I need to READ in 2 data files. when I run the program I don't know how to have it ask me for the second file?
I tried to use the RESET(INFILE) again hoping it would ask for another file, but it did not.
-Lars
Assignment : I have to READ in 2 data files. File 1 has 30 'Y' or 'N' and is the customer requests for the apartment. The second file has 5 line and each line has 30 'Y' or 'N' followed by an address. The goal is to read in the files and match up the customer with the best apartment by how many Yes's match and print out the address with it.
For this assignment I must use an Array. The problem that I have is not a programing issue (yet), but this is the first project that I need to READ in 2 data files. when I run the program I don't know how to have it ask me for the second file?
Code:
program test(infile, outfile);
type
ary = array[1..30] of char;
var
custwants : array[1..30]of char;
infile, outfile : text;
i : integer;
begin
reset(infile);
rewrite(outfile);
(**** Read in Customers Wants*)
for i := 1 to 30 do
read(infile, custwants[i]);
reset(infile);
for i := 1 to 30 do (* testing the read in*)
writeln(outfile, custwants[i]);
end.
I tried to use the RESET(INFILE) again hoping it would ask for another file, but it did not.
-Lars