ok so i need to write a program to give the week a person was born given the birthdate. it can be any date from 1900-1999
1)prompt for date blah blah
2) divide the last two digits of birthyear by 4 put quotient in a variable called total
3)add last 2 digits of birthyear to total
4)using the following table find the month number and add it to total
jan=1
feb=4
mar=4
april=0
may=2
june=5
july=0
august=3
september=6
october=1
november=4
december=6
6)if it is a leapyear and the mont you are workin with is either jan or feb then subtract 1 from total
7)find remainder when total is divided by 7 look up remainder in following table to determine day:
sunday=1
monday=2
tuesday=3
wed=4
thrus=5
friday-6
sat-0
so far i have
#include <iostream.h>
void main()
{
int month, day, year, LastTwoDigits, total, remainder;
cout << "Please enter the date in the form mm/dd/yyyy: ";
cin >> month >>day >>year;
LastTwoDigits = year-1900;
total = LastTwoDigits / 4;
total = total + LastTwoDigits;
total = total + day
switch(month)
{
case 1:
total = total + 1;
break;
case 2:
total = total + 4;
break;
case 3:
total = total + 4;
break;
case 4:
total = total;
break;
case 5:
total = total + 2;
break;
case 6:
total = total + 5;
break;
case 7:
total = total;
break;
case 8:
total = total + 4;
break;
case 9:
total = total + 6;
break;
case 10:
total = total + 1;
break;
case 11:
total = total + 4;
break;
case 12:
total = total + 6;
break;
default:
cout << "MONTH DOES NOT EXIST" << endl;
}
}