Guest User

Untitled

a guest
Jan 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4.  
  5.  
  6. enum Day {SUNDAY, SATURDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY};
  7.  
  8. using namespace std;
  9.  
  10. // Structure declaration
  11.  
  12. struct Date
  13. {
  14.  
  15. long year;
  16. long month;
  17. long day;
  18.  
  19. };
  20.  
  21.  
  22. int main ()
  23. {
  24.  
  25. /* getline(input_date)
  26. yr = year(input_date)
  27. dy = day (input_date)
  28. mo = month (input_date)
  29.  
  30. */
  31.  
  32. // Defining the structure
  33.  
  34. Date input_date;
  35.  
  36. cout << "Enter the year:" << endl;
  37. cin >> input_date.year;
  38.  
  39. cout << "Enter the month:" << endl;
  40. cin >> input_date.month;
  41.  
  42. cout << "Enter the day:" << endl;
  43. cin >> input_date.day;
  44.  
  45.  
  46. // Calculate the data
  47.  
  48. long gregorian_date = 15821015
  49.  
  50.  
  51.  
  52. input_date;
  53.  
  54. gregorian_date = October 15, 1582;
  55.  
  56.  
  57. intRes1 = 0;
  58.  
  59. {
  60. if (input_date < gregorian_date)
  61.  
  62. intRes1 = ((2 - yr) / (100 + yr)) / 400;
  63. }
  64. intRes2 = int (365.25 * yr);
  65.  
  66. intRes3 = int (30.6001 * (mo + 1) );
  67.  
  68. jdn = intRes1 + intRes2 + intRes3 + dy + 1720994.5 ;
  69.  
  70.  
  71.  
  72. DayofWeek = (JDN + 1) % 7;
  73.  
  74. cout << "The day of the week" << DayofWeek << endl;
  75.  
  76.  
  77. return 0;
  78.  
  79. }
Add Comment
Please, Sign In to add comment