Question: The date June 1 0 , 1 9 6 0 is special because when we write it in the following format, the month times the

The date June 10,1960 is special because when we write it in the following format, the month times the day equals the year:
6/10/60
Write a program that asks the user to enter a date in the format specified above (month/day/2-digit-year).
It is very important that the input is in the correct format, typed all at once, all on one line, by the user.
The program should then determine whether the month times the day is equal to the year. If so, it should display a message saying the date is magic. Otherwise it should display a message saying the date is not magic.
Hints: do not use any string variables. The program will be much simpler if you read the three data items (ie., number inputs) into three separate int variables. This may require a deeper understanding of the extraction operator than has been needed up to this point in your programming experience. For example, even though the user will be typing only one line of input, you will be using the extraction operator multiple times to read that input. (HINT: Use an additional char variable to extract, store and display the / character )
Here is a sample run (user's input shown in bold):
Enter a date in the format month/day/2-digit-year: 6/10/60
That is a magic date!
Assignment 1.2[20 points]
Write a C++ program that reads in three integer values that represent a month, date, and four-digit year. Your program should print the date in one of following formats depending on the user's input.
If the user enters 1, then print the month as a word ("January"), the date as an integer (11), and the year (1999).
If the user enters 2, then print the month as a three-letter abbreviation ( "Jan. "), date as an integer (11), and the year (1999).
If the user enters 3, then print month as an integer (01), the date as an integer (11), and the year (1999).
Here is a sample run (user's input shown in bold):
Please enter a date (three integers: month, day, year): 1211999
How would you like to print your date?
Month date, full year. (January 11,1999): Enter 1.
Abbreviated month date, full year (Jan.1,1999): Enter 2.
Month/date/year (12/1/1999): Enter 3.
1
If the user enters 1, then the output would be
December 1,1999.
Submit Your Work
Name your source code files according to the assignment number (a1_1.cpp, a1_2.cpp, etc.). Execute the program and copy/paste the output that is produced by your program into the bottom of the source code file, making it into a comment.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!