Validating date c


17-Sep-2017 15:57

Description: This program determines if when the user enters a month, day, and four digit year which will then be stripped down to its two digit year and determined to be a magic date if the day entered multiplied by the month entered equals the years two digit format.

Design: begin main input data Ask user for a month in number form Ask user for a day of the month Ask user for four digit month Validate begin is Date Valid if year is between 16, inclusive then return true if month is between 1 and 12, inclusive return true if month is Jan, Mar, May, July, Aug, Oct, Dec then if day is between 1 and 31 inclusive return true if month is Apr, June, Sept, Nov then if day is between 1 and 30 inclusive return true if month is Feb then determine if leap year by running function leap Year provided for us.

This is homework I will point out but was in need of someone to tell me what a moron I am because I am not seeing what it is that I am doing wrong.

I am supposed to let the user enter a month, day, and year to determine if it is a magic date. I am supposed to go back and validate the date using a function named is Date Valid.

You can use to verify whether the data entered by the user falls within the correct range—in the previously mentioned case, by assigning it an instance of the Date Time type.

The current text in the control will be validated either when the user leaves the control.

if leap year is true then if day is between 1 and 29, inclusive return true if not leap year then if day is between 1 and 28, inclusive then return true end is Date Valid if is Date Valid is true then Calculate if the month times the year is equal to the year modulus 100 then output it is a magic date if it does not equal the year in 2 digit form then output that it is not a magic date else output error message Output Program ID end main The output needs to include the books data of 6/10/1960 */ #include using namespace std; bool leap Year(int); bool is Date Valid(int, int, int); int main() //end main // is Date Valid function to validate date entered bool is Date Valid(int month, int day, int year) // End is Date Valid // leap Year function to determine if the year is a leap year for validation bool leap Year(int year) // end leap Year above it, or you're going to always be setting validation to true if that final test (number of days in month) passes.

I'm reading a book about C programming, at the end of each chapter it has some training exercise and one of them was to make a program that tells if a date is valid or not, the code below is what I did and I would like to know if it can be improved? The first leap century was 1600, but they can be calculated for earlier centuries.

using namespace std; bool leap Year(int); bool is Date Valid(int, int, int); int main() //end main // is Date Valid function to validate date entered bool is Date Valid(int month, int day, int year) // leap Year function to determine if the year is a leap year for validation bool leap Year(int year) // end leap Year EDIT Okay now my problem is that I am not getting that it is NOT A valid date when it is.In order to ensure the independence of the data validation, organizations will not use their own staff to conduct the data validation.