0

I need to o an assignment where i make two programs, one to write a list of players in a team and their scores, the other to read and search the .dat file for specific players. i have chosen to do this with an array but when i run my 1st program after i enter my first players score i get an exitcode 201. Im not sure what to do and im running out of time.
My Code

Program TeamWrite;
Var FName : String;
        UserFile : Text;
        Players : array[1..10] of string;
        Score : array[1..10] of integer;
        List1: Integer;
        List2: Integer;

BEGIN
      FName := 'Team';
        Assign(UserFile, 'C:\Team.dat');
        Rewrite(UserFile);
        FOR List1:= 1 to 10 DO
                begin
                    Writeln('Enter players name and score separated by pressing enter.');
                    Readln(Players[List1]);
                    Readln(Score[List2]);
                    Writeln(UserFile, Players[List1]);
                    Writeln(UserFile, Score[List2]);
                end;
        close(UserFile);
End.

Edited by R3CK2: Privacy

2
Contributors
1
Reply
5
Views
2 Years
Discussion Span
Last Post by SalmiSoft
0

Think what the value of List2 is in this line:

Writeln(UserFile, Score[List2]);

or here:

Writeln(UserFile, Score[List2]);

You don't initialize List2 to any known value and you never change it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.