943,753 Members | Top Members by Rank

Ad:
Apr 3rd, 2006
0

Fatal: Unexpected end of file

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
spoonhead is offline Offline
1 posts
since Apr 2006
May 12th, 2006
0

Re: Fatal: Unexpected end of file

How about you to try to debug your code?
Reputation Points: 10
Solved Threads: 1
Newbie Poster
nvanevski is offline Offline
12 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Pascal and Delphi Forum Timeline: What is the Easiest way to convert TP to VB
Next Thread in Pascal and Delphi Forum Timeline: Convert binary into text/text into binary





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC