|
int __fastcall MaxIntValue(const int * Data, const int Data_Size);
The MaxIntValue() function calculates the maximum
value of an array of integers. The first parameter of the function, Data,
represents the name of the array. The second argument, Data_Size is
the number-1 of members of the array.
|
To get the maximum value of a group of integers,
declare an integral array of numbers. You can initialize such a variable
or request the values of its members from the user. The value of the
Data_Size argument must be 1 less than the total number of the array
members.
Here is an example that uses the MaxIntValue()
function:
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Integer n, MaxInteger;
Integer Numbers[] = { 15, 408, 72, 995, 32 };
MaxInteger = MaxIntValue(Numbers, 4);
Edit1->Text = IntToStr(MaxInteger);
}
//---------------------------------------------------------------------------