System: Windows Xp Pro/Pentium D 2.80gz - 480mb Ram
Compiler/IDE: TURBO PASCAL FOR DOS
Libraries/API: Not sure


I can't figure out how to write a user's score to the file, then display the file scores.txt to the screen.

I've been trying for weeks to get it to work, so any help would be greately appreciated!

thank you xx



[pascal]PROGRAM PenaltyShootout (input, output);

{

Programmer: Konspiracy
Program Name: Penalty Shoot-Out
Program Version: BETA 6
Date: 03-MAY-07
}


USES CRT;
VAR
uname:string[20];
uage:integer;
shots_taken:integer;
user_score:integer;
user_choice:integer;
goal_keeper:integer;

play_again:char;
Shots_Left:integer;
Menu_Choice:integer;
fileout:text;

Procedure Details_Display;
{
This procedure is the first screen the user sees.
It logs the user's name and age
}
BEGIN
clrscr;
Writeln (' ');
Writeln ('Please enter your name: ');
readln (uname);
Writeln ('Please enter your age: ');
readln (uage);
clrscr;
END;

Procedure Shots;
{
This procedure is the actual game, it decides the goal keeper's choice
and logs the user's choice and decides on whether the ball is saved or not.
It also checks and displays how many goals you have left.
}
BEGIN
clrscr;
FOR Shots_Taken:=1 to 10
DO
BEGIN
repeat

Shots_Left:=11-Shots_Taken;
writeln ('Take a shot, you have ',Shots_Left, ' Shots Left!');
readln(user_choice);
clrscr;
if (user_choice>3) or (user_choice<1>=1) and (user_choice<=3);
goal_keeper:=RANDOM(3)+1;

IF user_choice=goal_keeper THEN
begin
writeln('The Goal Keeper Saved The Ball!');
writeln (' ');
end;

IF user_choice<goal_keeper>=5 THEN
writeln('Congratulations, ',uname, '! You scored ', user_score)
ELSE
Writeln('Unlucky, ',uname, '! You scored ', user_score, '. Try harder!');
END;

Procedure Play_Again_Proc;
{
This asks the user if they would like to play the game again, after taking
their 10 shots at the goal.
}
BEGIN
writeln(' ');
Writeln('Would you like to play again? (Y/N)');
user_score:=0;
readln(play_again);
END;

Procedure Intro_Instructions;
{
This is the instructions for the user to read from the main menu
}
BEGIN
clrscr;
Writeln (' ');
Writeln ('You have 10 penalty shots at the goal keeper.');
Writeln ('Try and score a goal!');
Writeln ('Press 1. Left');
Writeln ('Press 2. Right');
Writeln ('Press 3. Centre');
Writeln (' ');
Writeln ('Press 0. To Go Back To The Main Menu.');
readln(Menu_Choice);
END;

procedure high_scores;
{
Displays the file scores.txt to the screen, which contains all the
scores from the user
}

BEGIN
assign(fileout,'H:\scores.txt');
reset(fileout);
while not eof(fileout) do
readln(fileout, uname);
END;


Procedure Main_Menu;
{
This is the main menu where the user can select which option they want
}
BEGIN
clrscr;
Writeln('Welcome to Penalty Shoot-Out, ', uname, '.');
Writeln('Please choose from the following options:');
Writeln('1. Play the game.');
Writeln('2. Instructions.');
Writeln('3. Highscores.');
Writeln('4. Credits.');
Writeln('5. Exit.');
readln(Menu_Choice);

if Menu_Choice=1 THEN
repeat
Shots;
Score;
Play_Again_Proc;
until play_again='n';



if Menu_Choice=2 THEN
repeat
Intro_Instructions;
until Menu_Choice=0;
if Menu_Choice=0 THEN
Main_Menu;


if Menu_Choice=4 THEN
repeat
clrscr;
Writeln('Engine coded by Konspiracy');
Writeln('Tutor: John Robinson');
Writeln('Lesson: Software Development');
Writeln(' ');
Writeln('Press 0. For Main Menu');
readln(Menu_Choice);
until Menu_Choice=0;
if Menu_Choice=0 THEN
Main_Menu;


if Menu_Choice=3 THEN
repeat
high_scores;
readln(Menu_Choice);
until Menu_Choice=0;
if Menu_Choice=0 THEN
Main_Menu;



END;


BEGIN

RANDOMIZE;
Details_Display;
Main_Menu;

END.[/pascal]