Math Functions: The Maximum Value of a Series



double __fastcall MaxValue(const double * Data, const int Data_Size);

The MaxValue() function is a numeric value that represents the maximum number of items of an array. This function takes two arguments. The first argument, Data, represents an array of integers or double-precision numbers. The second argument is the number-1 of the items of the array; for example, if the considered array has 4 members, the Data_Size argument would be 3.


To use the MaxValue() function, declare an array that involves the necessary numbers. You can initialize such a variable or request the numbers from the user. To calculate the maximum value of a range, supply the array and its size. If you do not know the dimension of the array, you can use the sizeof operator to find it out. Here is an example of using the MaxValue() function:

void __fastcall TForm1::Button1Click(TObject *Sender)
	double Values[] = { 12.55, 10.15, 980.22, 50.50, 280.12 };
	int Size = (sizeof(Values)/sizeof(double)) - 1;

	double Maximum = MaxValue(Values,Size);

	Edit1->Text = Maximum;



Home Copyright © 2010-2016, FunctionX