1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
les variables, et records
// Begin of Records
Type
Texaminer = record
ExaminerName : string [15];
Examinerno : string[10];
ExaminerAddress: string [30];
TotalScripts: integer;
PaymentNet : real;
PaymentBrut : real;
end ;{of Texaminer}
Tsubject = record
SubjectName : String [15];
SubRefCode: string [5];
SubPaymentScript: real;
ExaminerNo: integer;
end;{of Tsubject}
Tcentre = record
SubRefCode : string [15];
CentreNo : string[10];
CentreName : string [15];
TotCand: integer;
end; {of Tcentre}
//Begin of Variables
var
// Variables of Choices in the menu
MenuChoice: char;
NewRequestChoice: char;
ExaminerListChoice: char;
SubjectListChoice: char;
RepeatRequest : integer;
// Variables of Files
ExaminerFile: file of Texaminer;
Examiner: array [1..20] of Texaminer;
SubjectFile: file of Tsubject;
Subject: array [1..15] of Tsubject;
CentreFile: file of Tcentre;
centre: array [1..20] of Tcentre;
la procedure Newdetails
Procedure NewDetails;
var a: integer;
Position:longint;
begin
if FileExists('Examiner.dat')then // change the position if you copy, cut the program !
begin
Assign(ExaminerFile, 'Examiner.dat'); // if file exists then take the right position in the file
Reset (examinerFile) ;
Position := Filesize(ExaminerFile); //calcul the all the details registered
Seek(ExaminerFile, Position); //take the position after the last details registered (for a new request)
Assign(SubjectFile, 'Subject.dat');
Reset (SubjectFile) ;
Assign (CentreFile, 'Centre.dat');
Reset (CentreFile);
end
else
begin
AssignFile (ExaminerFile, 'Examiner.dat'); // if the file doesn't exist then create a new file
Rewrite(ExaminerFile);
AssignFile (SubjectFile, 'Subject.dat');
Rewrite(SubjectFile);
AssignFile (Centrefile, 'Centre.dat');
Rewrite(CentreFile);
end;
Write ('How many examiner details do you want to enter? ');
Readln (RepeatRequest);
for a:= 1 to RepeatRequest
do
begin
Writeln ('');
Writeln ('NEW DETAILS N',a);
Writeln ('--------------');
Write (' Enter the examiner name: ');
Readln (Examiner[a].ExaminerName);
GetValidExaminerno(a);
Write (' Enter the examiner address: ');
Readln (Examiner[a].ExaminerAddress);
Write (' Enter the total number of script marked: ');
Readln (Examiner[a].TotalScripts);
GetValidSubRefCode (a);
Write (' Enter the subject name: ');
Readln( Subject[a].SubjectName);
Write (' Enter the payment for marking each script: ');
Readln (Subject [a].SubPaymentScript);
GetValidCentreno (a);
Write (' Enter the centre name: ');
Readln (Centre[a].Centrename);
Write (ExaminerFile, Examiner[a]);
Write (SubjectFile, Subject[a]);
Write (CentreFile, Centre[a]);
end;
Closefile (ExaminerFile);
Closefile (SubjectFile);
Closefile (CentreFile);
Writeln ('');
Writeln ('');
Writeln (' Sub-menu of New Request ');
Writeln (' ------------------------');;
end; {of procedure}
et la procedure ou j'appelle mes données pour la blackscreen.
begin
AssignFile (examinerFile, 'examiner.dat');
Reset (examinerFile);
AssignFile (Centrefile, 'centre.dat');
Reset (centrefile);
Ptr := 0;
Writeln ('-Name- -Centre Number- -Centre Name- -Number of scripts marked-');
while not eof (examinerfile) and not eof (centrefile)
do
begin
Ptr := Ptr + 1;
Writeln ('');
Read (examinerfile, examiner[ptr]);
Read (centrefile, centre[ptr]);
Writeln ('');
Write (examiner[ptr].examinername,' ',centre[ptr].centreno,' ');
Writeln (centre[ptr].centrename,' ',examiner[ptr].totalscripts);
end;
Readln;
Closefile (examinerfile);
Closefile (centrefile);
Writeln ('');
Writeln ('');
Writeln (' Sub-menu of Examiner List ');
Writeln (' -------------------------');
end; |
Partager