/*
Declare a one-dimensional array of type float and of maximum size 100. 
Then ask the user to enter the actual size of the array (the number of 
elements that will be used). The read the array. Then find the maximum 
(largest) element of the array. 
*/

#include <iostream>
using namespace std;
int main()
{
	const int n = 100;
	float a[n], max;
	int i, size;
	cout << "Enter the size of the array (< 101): ";
	cin >> size;
	if (size > 0 && size <= 100)
	{
		cout << "Enter " << size << " real numbers: " << endl;
		for (i = 0; i < size; i++)
			cin >> a[i];
		max = a[0];
		for (i = 1; i < size; i++)
			if (a[i] > max)
				max = a[i];
		cout << "The maximum element is: "
			<< max << endl;
	}
	else
		cout << "Invalid size.\n";
	return 0;
}

