Largest integer value

Description:

Write a C++ program to find the max of an integral data set. The program will ask the user to input the number of data values in the set and each value. The program prints on screen a pointer that points to the max value. Test Case 1 Input (stdin) 5 1 2 3 4 5 Expected Output Largest integer value in the array is 5 Test Case 2 Input (stdin) 3 78 67 46 Expected Output Largest integer value in the array is 78

Program :

#include <iostream>

using namespace std;

int main()

{

    int i, n;

    float arr[100];

    //cout << "Enter total number of elements(1 to 100): ";

    cin >> n;

    cout << endl;

    // Store number entered by the user

    for(i = 0; i < n; ++i)

    {

       //cout << "Enter Number " << i + 1 << " : ";

       cin >> arr[i];

    }

    // Loop to store largest number to arr[0]

    for(i = 1;i < n; ++i)

    {

       // Change < to > if you want to find the smallest element

       if(arr[0] < arr[i])

           arr[0] = arr[i];

    }

    cout << "Largest integer value in the array is " << arr[0];

    return 0;

}