943,535 Members | Top Members by Rank

Ad:
Feb 21st, 2009
0

Undetermined numbers

Expand Post »
Alright, I'm trying to write a program that finds the highest, lowest, and average number of a set of undetermined data. The program also needs to shut off when a negative number is entered.


This is what I have so far, the only thing working is the highest number and shutting off when a negative number is entered.... please help thanks so much



program TestData;

uses
Forms;

{$R *.RES}




var
outfile:textfile;
number,hi,lo,A:integer;
name:string;


Procedure Start;

begin

assignFile(outfile,'TestData.out');
rewrite(outfile);
write('What is your name?: ');
readln(name);
writeln(outfile,'This program was run by: ',name);
writeln(outfile);
repeat
writeln('Enter your number: ',number);
readln(number);


A:=number+number;
if hi<number then hi:=number;
if (number<hi) and (number>0) and not (number=0) then lo:=number;


until number<0;
writeln(outfile,'The Highest number is :',hi);
writeln(outfile,'The lowest number is : ',lo);
writeln(outfile,'The average is: ',A);

end;


Procedure Done;
begin
writeln(outfile,'This program was created by me');
closefile(outfile);

end;

begin
Start;
Done;
end.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
la65cop is offline Offline
1 posts
since Feb 2009
Feb 23rd, 2009
0

Re: Undetermined numbers

Have you tested this? What happens? What help are you looking for?
Reputation Points: 11
Solved Threads: 11
Junior Poster in Training
jsosnowski is offline Offline
68 posts
since Nov 2007

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: managed and unmanaged memory
Next Thread in Pascal and Delphi Forum Timeline: Declaring a Record Type using Case.





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


Follow us on Twitter


© 2011 DaniWeb® LLC