What is the c plus plus program that finds max value in the array of size n?

Answer:
#include <iostream>

using std::cout;
using std::endl;

double maxValue(double arr, const int arrSize);

int main()
{
const int arrSize = 10;//Size of the array you are going to use
double arr[arrSize] = {0.0};
cout << endl << "Enter the array elements..."
for ( int i = 0; i < arrSize; i++ )
{
cout << endl << "Enter " << (i + 1) << " element:";
cin >> arr[i];
}

cout << endl << "Max value is: " << maxValue;

system("PAUSE");
return 0;

}

double maxValue(double arr, const int arrSize)
{
double max = arr[0];
for ( int j = 0; j < arrSize; j++ )
{
if ( max < arr[j])
{
max = arr[j];
}
}

return max;

}
First answer by Archangel dmitry. Last edit by Archangel dmitry. Contributor trust: 474 [recommend contributor recommended]. Question popularity: 1 [recommend question].