//Devin Scheu CS1A Chapter 4, P. 220, #3
//
/**************************************************************
*
* DETERMINE IF DATE IS MAGIC
* ____________________________________________________________
* This program asks for a month (in numeric form),
* a day, and a two-digit year, then checks if the month times
* the day equals the year.
*
* Computation is based on the condition:
* isMagic = (month * day == year)
* ____________________________________________________________
* INPUT
* month : The month in numeric form (as an integer)
* day : The day of the month (as an integer)
* year : The two-digit year (as an integer)
*
* OUTPUT
* message : Indicates whether the date is magic or not
*
**************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main () {
//Variable Declarations
int month; //INPUT - The month in numeric form (as an integer)
int day; //INPUT - The day of the month (as an integer)
int year; //INPUT - The two-digit year (as an integer)
string message; //OUTPUT - Indicates whether the date is magic or not
//Prompt for Input
cout << "Enter the month (1-12): ";
cin >> month;
cout << "\nEnter the day: ";
cin >> day;
cout << "\nEnter the two-digit year: ";
cin >> year;
//Determine if Date is Magic
if (month * day == year) {
message = "The date is magic!";
} else {
message = "The date is not magic.";
}
//Output Result
cout << "\n";
cout << left << setw(25) << "Month:" << right << setw(15) << month << endl;
cout << left << setw(25) << "Day:" << right << setw(15) << day << endl;
cout << left << setw(25) << "Year:" << right << setw(15) << year << endl;
cout << left << setw(25) << "Result:" << right << setw(15) << message << endl;
} //end of main()