Undetermined numbers

Please support our Pascal and Delphi advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2009
Posts: 1
Reputation: la65cop is an unknown quantity at this point 
Solved Threads: 0
la65cop la65cop is offline Offline
Newbie Poster

Undetermined numbers

 
0
  #1
Feb 21st, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 68
Reputation: jsosnowski is an unknown quantity at this point 
Solved Threads: 11
jsosnowski's Avatar
jsosnowski jsosnowski is offline Offline
Junior Poster in Training

Re: Undetermined numbers

 
0
  #2
Feb 23rd, 2009
Have you tested this? What happens? What help are you looking for?
Reply With Quote Quick reply to this message  
Reply

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



Other Threads in the Pascal and Delphi Forum
Thread Tools Search this Thread



Tag cloud for Pascal and Delphi
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC