This is what I have so far but I am not getting the right outputs.
#include <iostream>
using namespace std;
int main(void) {
int year_number, month_number, day_number;
cout << "What year were you born in?\n";
cin >> year_number;
cout << "What month were you born in?\n";
cin >> month_number;
cout << "What day were you born on?\n";
cin >> day_number;
month_number -= 2;
if (month_number < 0) {
month_number += 12;
year_number -= 1;
}
month_number *= 83 / 32;
month_number += day_number;
month_number += year_number;
month_number += (year_number / 4);
month_number -= (year_number / 100);
month_number += (year_number / 400);
day_number = month_number % 7;
cout << "The weekday number you were born on is " << day_number << endl;
return 0;
}
Here are the instructions:
- Decrease month number by 2;
- if month number becomes less than 0, increment it by 12 and decrement year by 1;
- take month number and multiply it by 83 and divide it by 32;
- add day number to month;
- add year number to month;
- add year/4 to month;
- subtract year/100 from month;
- add year/400 to month;
- find the remainder of dividing month by 7;