C++ Programming Code Examples C++ > Arrays and Matrices Code Examples Programming to Find Largest Element in Array Programming to Find Largest Element in Array To find the largest element in an array in C++ programming, you have to ask to the user to enter the array size, again ask to enter the array elements. Now start finding for the largest element in the array to display the largest element of the array on the output screen as shown here in the following program. Following C++ program ask to the user to enter the array size and then array element to find the largest number present in the array, then display the result on the screen: #include<iostream.h> #include<conio.h> void main() { clrscr(); int large, arr[50], size, i; cout<<"Enter Array Size (max 50) : "; cin>>size; cout<<"Enter array elements : "; for(i=0; i<size; i++) { cin>>arr[i]; } cout<<"Searching for largest number ...\n\n"; large=arr[0]; for(i=0; i<size; i++) { if(large<arr[i]) { large=arr[i]; } } cout<<"Largest Number = "<<large; getch(); }