Question: The function needed to be completed in C++ and only the Fuction is needed. the fuction is title Date ThirdLatest(std::vector & dates) { } all

The function needed to be completed in C++ and only the Fuction is needed.
the fuction is title
Date ThirdLatest(std::vector & dates) {
}
all of the sorting needs to be done within the fuction and return the third latest date only. So something like: return input[2]; or something close
the structure of the date is already programed in and it is
struct date
{
int Day;
int Month;
int Year;
};
Assume the array of dates is already in a main method and being passed through the function ThirdLatest.
so the input would look like this:(first numbering being the size of the array)
5 18-01-1998 19-01-1999 20-01-2002 21-01-2001 22-01-2000
output would look like this:
22-01-2000
You are provided with an array of custom Date objects. A date has members Day, Month and Year of type integer, and is represented in input and output as "DD-MM-YYYY" Implement below function such that it returns the third-latest date, given such an array of Date objects. You may assume the input array will always have at least 3 distinct elements, and that the dates in the input are valid. Please don't use built-in date/time classes other than the one provided. Extra marks are given for an efficient implementation. Example: Input: [14-04-2001, 29-12-2061, 21-10-2019, 07-01-1973, 19-07-2014, 11-03-1992, 21-10-2019] Output: 19-07-2014
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
