how to get max and min dates when i have days,months and years arrays

how to get max and min dates when i have days,months and years arrays. i want most general code so pls tell me your steps of thinking . only <iostream><cmath><string> libraries are allowed bec it is a project
Last edited on
Look at each date. Find the highest year.
Then look at each date again, finding the highest month in the dates which have the same year as the highest year.
Then look at each date again, finding the highest day in the dates which have the same year as the highest year and the same month as the highest month.
That's the highest date.

For lowest date, repeat, but instead of the highest year/month/day, find the lowest.
Create either a string or an integer (depending on the format of the existing arrays) which contains the date in the format yyyymmdd. Then the highest and lowest value is readily found by simple comparison.
thanks all for ur answers both i apperciate it.
Topic archived. No new replies allowed.