I have a menu system which can allows me to list all the contestants. The following is my menu system:
Program Student_millionaire;
{$APPTYPE CONSOLE}
uses
SysUtils, OurCrt;
Var User_Choice:Integer;
Procedure ContestantsList;
Begin
WriteLn('1 pressed,listing all the contestants...');
ReadLn;
End;
Procedure Generate10finalists;
Begin
WriteLn('2 pressed,generating the 10 finalist''s numbers...');
ReadLn;
End;
Procedure UpdateFinalists;
Begin
WriteLn('3 pressed,finding and listing the finalists...');
ReadLn;
End;
Procedure ChangeDetails;
Begin
WriteLn('4 pressed,changing the phone a friend details...');
ReadLn;
End;
Procedure EnrolContestant;
Begin
WriteLn('5 pressed,enroling a new contestant...');
ReadLn;
End;
Procedure GetOutOfHere;
Begin
WriteLn('6 pressed,exiting...');
Sleep(1000);
End;
Begin
User_Choice:=0;
While User_Choice <> 6 Do Begin
ClrScr;
WriteLn('Please enter an integer in the range 1...6');
WriteLn;
WriteLn(' 1 List all the contestants');
WriteLn(' 2 Generate the 10 finalist''s numbers');
WriteLn(' 3 Find and list the finalists');
WriteLn(' 4 Change the phone a friend details');
WriteLn(' 5 Enrol a new contestant');
WriteLn(' 6 Exit');
WriteLn;
ReadLn(User_Choice);
Case (User_Choice) of
1:ContestantsList;
2:Generate10finalists;
3:UpdateFinalists;
4:ChangeDetails;
5:EnrolContestant;
6:GetOutOfHere;
Else
Begin
WriteLn('Wrong Number..');
WriteLn('Exiting...');
End;
End;
End;
End.
To fulfill the listing of the contestant:
- May I want to declare a file of records?
- May I want to prepare a file for output with the assign and rewrite statements?
- May I want to store records in a file with write?
- May I want to write files with multiple records?
- Close a file.
And I have written the following programming, but it doesn't work:
program Project2;
{$APPTYPE CONSOLE}
type
Millionaire_record=record
first_name: String[12];
last_name: String[12];
address: String[25];
end;
var
Person: Millionaire_Record;
Person: array[1..40] of Millionaire_Record;
begin
WriteLn('Enter the first name of person >> ');
ReadLn('person.first name');
end.
May I need to combine this program together with the first program? How can I do?