Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- enum Day {SUNDAY, SATURDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY};
- using namespace std;
- // Structure declaration
- struct Date
- {
- long year;
- long month;
- long day;
- };
- int main ()
- {
- /* getline(input_date)
- yr = year(input_date)
- dy = day (input_date)
- mo = month (input_date)
- */
- // Defining the structure
- Date input_date;
- cout << "Enter the year:" << endl;
- cin >> input_date.year;
- cout << "Enter the month:" << endl;
- cin >> input_date.month;
- cout << "Enter the day:" << endl;
- cin >> input_date.day;
- // Calculate the data
- long gregorian_date = 15821015
- input_date;
- gregorian_date = October 15, 1582;
- intRes1 = 0;
- {
- if (input_date < gregorian_date)
- intRes1 = ((2 - yr) / (100 + yr)) / 400;
- }
- intRes2 = int (365.25 * yr);
- intRes3 = int (30.6001 * (mo + 1) );
- jdn = intRes1 + intRes2 + intRes3 + dy + 1720994.5 ;
- DayofWeek = (JDN + 1) % 7;
- cout << "The day of the week" << DayofWeek << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment