So far as you can see below Ive got the program accessing the file and just reading the lines; Ive got the file set up like so...
What is the Answers?
A Do this
B Do that
C Dont do that
D Definitely this
So this method is set up that ive got 12 questions in this format stored in the file to display to the user....
BUT the requirements of what I need to do are to display 12 questions randomly each time from a block of say 100 questions which would be stored on the file. Ive a rough idea Id use the Random function in Pascal but am so far baffled.
(Obviously this section is a procedure ive lifted from a much bigger program so the recordtype isnt shown in case anyone was wondering)
Any help would be greatly appreciated!
Assign(Quizfile, 'S:\quizfile.dat'); Reset(Quizfile); While not EOF (Quizfile) DO Begin For J:= 1 TO 5 DO Begin Readln(Quizfile, line); Writeln(line); End; Readln(Quizfile, line); Writeln('Please enter the letter you think is correct'); Readln(answer); Writeln; IF UPCASE(answer) = line THEN Begin Writeln('Correct'); Writeln; UserList.List[i].Money := UserList.List[i].Money + 5; UserList.List[i].Score := UserList.List[i].Score +1; End ELSE Begin Writeln('Wrong'); Writeln; UserList.List[i].Money := UserList.List[i].Money - 5; UserList.List[i].Score := 0+UserList.List[i].Score; End; End; Close(Quizfile); End; End;