Searching an array for the second greatest value using C++

Hi, this is Mazen. Today we're going to solve a new programming question using C++. We previously talked about searching an array for an entered number. Searching for the greatest or second greatest number is basically the same. Because finding the greatest value in an array isn't a huge issue, we're going to make our question a bit harder to find the second greatest number. In this example, we use arrays, loops, if statements and the ternary operator . The question says: Write a program that finds the second greatest number in an array Step 1: Declare an integer array with the size of 5, for instance. int test[5]; Step 2: Get five numbers from the user and store them in the declared array. You can use a for loop to perform that. The number of repetitions is the same as the size of the array. for (int i = 0; i < 5; i++) { std::cout << "Integer #" << i + 1 << ": "; std::cin >> test[i]; ...