Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 is special because when we write it in the following format, the month times the day equals the year:
Write a program that asks the user to enter a date in the format specified above monthdaydigityear
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 users input shown in bold:
Enter a date in the format monthdaydigityear:
That is a magic date!
Assignment points
Write a C program that reads in three integer values that represent a month, date, and fourdigit year. Your program should print the date in one of following formats depending on the user's input.
If the user enters then print the month as a word January the date as an integer and the year
If the user enters then print the month as a threeletter abbreviation "Jan. date as an integer and the year
If the user enters then print month as an integer the date as an integer and the year
Here is a sample run users input shown in bold:
Please enter a date three integers: month, day, year:
How would you like to print your date?
Month date, full year. January : Enter
Abbreviated month date, full year Jan: Enter
Monthdateyear : Enter
If the user enters then the output would be
December
Submit Your Work
Name your source code files according to the assignment number acpp acpp etc. Execute the program and copypaste 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
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