C++ Exercises: Find second largest element in a given array of integers
3. Second Largest Element in Array
Write a C++ program to find the second largest element in an array of integers.
Sample Solution:
C++ Code :
Sample Output:
Original array: 7 12 9 15 19 32 56 70 The second largest element is: 56
Flowchart:

For more Practice: Solve these Related Problems:
- Write a C++ program to find the second largest number in an array by keeping track of the largest and second largest values.
- Write a C++ program that sorts the array and then selects the unique second largest element from the sorted list.
- Write a C++ program to iterate through an array and update two variables to capture the highest and second highest values.
- Write a C++ program that reads an array and prints the second largest element, handling cases with duplicate maximum values.
C++ Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a C++ program to find the largest three elements in an array.
Next: Write a C++ program to find k largest elements in a given array of integers.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.