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 any 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. See the hints below.) 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. in C++ Do not use any string variables in this assignment. Hints: Read the three data into three separate int variables. 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. I strongly suggest that you review lesson 2.9 before starting on this assignment. To make your job easier, we will specify that it is still a valid date if the user uses a different punctuation character instead of a slash. For example, 6%1

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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 any 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. See the hints below.) 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. in C++

Do not use any string variables in this assignment.

Hints: Read the three data into three separate int variables. 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. I strongly suggest that you review lesson 2.9 before starting on this assignment.

To make your job easier, we will specify that it is still a valid date if the user uses a different punctuation character instead of a slash. For example, 6%10;60 would be a valid date (and a magic date).

Here are two sample runs (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! Enter a date in the format month/day/2-digit-year: 6/10/61 That is not a magic date!

If you are having trouble handling the slashes, I'd suggest that you begin by writing the following program, which is one step toward the complete program: Write and test a complete program that (1) asks the user to enter a month followed by a single punctuation character, and then (2) prints the month and punctuation character that were entered. Here is a sample run of this first-step program (user's input shown in bold):

Enter a month as an integer, followed by a punctuation character: 6# You entered the month 6 followed by the punctuation character # 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education