Guys, Im in desperately need of help, and I need the whole program to be written, as I dont understand anythuing in pascal haha.
Thanks for any help, I really appreciate it!
By the way, this is also my first post here, yay :D

Hi satasonic
In pascal there are two functions like Low() and High()

Program LowAndHigh;
Uses Crt;
Var MyArray:Array[0..124]Of Byte;
Begin
     ClrScr;
     {min value:Low function}
     WriteLn('Minimum value of MyArray: ',Low(MyArray));
     {max value:High function}
     WriteLn('Maximum value of MyArray: ',High(MyArray));
     ReadLn;
End.
{Written by FlamingClaw}

Is this the whole program? I put it in and it didnt seem to work, when I typed a number it just minimized.
Sorry, but im really stupid in Pascal lol

Is this the whole program? I put it in and it didnt seem to work, when I typed a number it just minimized.
Sorry, but im really stupid in Pascal lol

Of course this is the whole program.
Contains an array and two functions's calling.
And it is working
I wrote my program in dev pascal 1.9.2.It is a free pascal compiler,support (almost) every commands of the Turbo Pascal 7.0,and 100% free pascal compatible and it is free....

I wonder, High and Low return the highest and lowest array index iirc. Isn't he looking for Min and Max ?

I wonder, High and Low return the highest and lowest array index iirc. Isn't he looking for Min and Max ?

If you try my code (just copy and paste) ,you will see the results low as 0 and high as 124,the type of byte's range is 0..255 :D
But he want to know the max range of byte type then

Program Solution;
Uses Crt;
Var my:Array[Byte]Of Byte;
Begin
     ClrScr;
     WriteLn(High(my));
     ReadLn;
End.
{the result is 255}

So we can help a little better, could clarify what you need a little?

Do you need the highest and lowest VALUE in the array? What type of array are you using (integer, float, etc)? How should the program receive the array?

If you decide to take a whack at it yourself (and you're looking for min max values), you'll basically want to have a program that starts with two variables "MIN" and "MAX". Set them both to the first value in your array. Then loop through the array, comparing each number to min and max. If a number is less than the value in MIN, set MIN to that number. If a number is greater than MAX, set MAX to that number.

If a number is less than the value in MIN, set MIN to that number. If a number is greater than MAX, set MAX to that number.

And it will look like this (for getting the minimum value):

var
  MinValue, I: Integer;

for I:= Low(MyArray) to High(MyArray) do
begin
  if I = Low(MyArray) then MinValue:= MyArray[I] else
  if MyArray[I] < MinValue then MinValue:= MyArray[I];
end;

Sincerely,
Tom Barnett
SNIP

When I was a beginer, I was doing random problems in Pascal. Here is one that might help you...

uses
    crt;
var
   i, control : longint;
   input, sum : real;
begin
     writeln('Enter the total number of inputs. Then, enter them one by one until you see an output.');
     readln(control);
     sum := -1000000;
     for i := 1 to control do
         begin
              readln(input);
              if input >= sum then
                 begin
                      sum := input;
                 end;
         end;
     writeln(sum:0:4);
     readln;
end.

I also have a program that find the minimum of the given input. But, I'll leave that and the array part for you to work out. After all, I shouldn't have to all the work. :|

Good luck!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.