Fatal: Unexpected end of file

Reply

Join Date: Apr 2006
Posts: 1
Reputation: spoonhead is an unknown quantity at this point 
Solved Threads: 0
spoonhead spoonhead is offline Offline
Newbie Poster

Fatal: Unexpected end of file

 
0
  #1
Apr 3rd, 2006
I keep getting this can you guys look at my code and see whats up

PROGRAM LargeandSmall;
USES Wincrt;
{*----------------------------------------------------------------------*/
var
Nums:Array[1..10] of INTEGER;
Largest:INTEGER;
Smallest:INTEGER;
menuchoice:INTEGER;
i:INTEGER;
anykey:CHAR;
{*-----------------------------------------------------------------------*/
PROCEDURE initialise;
VAR
i:INTEGER;
BEGIN
FOR i:=1 to 10 DO
num[i]:=0
Largest:=0;
Smallest:=32767;
End;
{*-----------------------------------------------------------------------*/
FUNCTION get_menu_choice;
VAR
i:INTEGER;
choice:integer;
Begin
FOR i:=1 to 10 DO
Writeln;
Writeln(' LARGE & SMALL MENU');Writeln;Writeln;
Writeln(' 1. Ten numbers')Writeln;
Writeln(' 2. Any numbers, terminate with 999');Writeln;
Writeln(' 3. Exit');Writeln;Writeln,Writeln;
Writeln;Writeln;Writeln;Writeln;
Write('Please enter your choice:');
Readln(choice)
get_menu_choice:=choice;
End
{*------------------------------------------------------------------------*/
Function getnum;
VAR

num : INTEGER;
i : INTEGER;
BEGIN
Repeat
FOR I:=1 to 10 DO
Writeln;
Write('Enter a number: ');
Readln (num);
If num <=0 THEN
BEGIN
Writeln('Invalid number, try again');Writeln;
Writeln;Writeln;Writeln;
End;
UNTIL num>0
getnum:=num;
END
{*-------------------------------------------------------------------------*/
BEGIN
REPEAT
initialise
menuchoice:=get_menu_choice;
CASE menuchoice OF
1: BEGIN
FOR I:=1 to 10 DO
BEGIN
num[i]:=getnum
IF nums[i]>Largest THEN
Largest:=num[i];
IF nums[i]<Smallest THEN
Smallest:=nums[i];
END;
End;
2: BEGIN
i:=0;
nums[i]:=getnum
While nums[i]<>999 DO
BEGIN
IF nums[i]>Largest TEN
Largest:=nums[i];
IF nums[i]<Smallest THEN
Smallest:=nums[i];
i:=i+1;
nums[i]:=getnum;
END
Writeln;Writeln;Writeln;
Writeln(' The largest numbers is: ',Largest);
Writeln;Writeln;Writeln;
Writeln(' The smallest numbers is: ',Smallest;
Writeln('Press any key to return to menu');
anykey:=readkey;
END;
3: Writeln('Exit chosen.....');
OTHERWISE:
Writeln('Incorrect selection, try again');Writeln;
UNTIL menuchoice=3;
END.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 12
Reputation: nvanevski is an unknown quantity at this point 
Solved Threads: 1
nvanevski nvanevski is offline Offline
Newbie Poster

Re: Fatal: Unexpected end of file

 
0
  #2
May 12th, 2006
How about you to try to debug your code?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC