Question
C++ Write a function, named isDate(), that takes three integer arguments representing a calendar date as month, day, and year. The function returns a bool
C++
Write a function, named isDate(), that takes three integer arguments representing a calendar date as month, day, and year. The function returns a bool true if the date is valid and returns false if the date is invalid. The function does not read any input or write any output.
The date is valid if the year is between 1600 and 2400, inclusive, the month is between 1 and 12, inclusive, and the day is within the appropriate range for the month. The isDate() function must call the daysInMonth() function to determine the number of days in a month. The function, isDate(), does not have any input or output statements in it.
Write a main() function to input a date (as three integers, month, day, and year), call the
isDate() function and write the output.
Sample Output:
Input Date: 02-09-1995
VALID!
Input Date: 06-31-1993
INVALID DATE!
Input Date: 10-01-2000
VALID!
Input Date: 13-15-1999
INVALID DATE!
Always print two digits for the month and day, and separate the month, day, and year with
hyphens. If the date is invalid, write INVALID DATE on the same line after the date, but if the date is valid, write "VALID!".
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started