Write a program to get a date from the user in the format day/month/year. Tip: use extra variables to read the /. The program should check the three parts of the date (day, month, year), and print a warning message for any part of the date that is wrong. If the whole date is correct, it should print a message saying that the date is valid. The normal rules for dates apply: valid days are from 1 to 28, 29, 30, or 31 (depending on the month and on whether the year is a leap year. You might want to use a switch statement to perform this task.); valid months are from 1 to 12; valid years start from 1582 (the year in which our current calendar system started). The rule for deciding if a year is a leap year is as follows: a year evenly divisible by 4 is a leap year; except if the year is evenly divisible by 100, in which case it is not a leap year; except if the year is evenly divisible by 400, in which case it is a leap year.
Enter a date (d/m/y): 29/2/2002
The day 29 is not valid!
Enter a date (d/m/y): 32/15/1002
The year 1002 is not valid!
The month 15 is not valid!
The day 32 is not valid!
Enter a date (d/m/y): 20/9/2002
The given date is valid.