I was kind of waiting to see if any code showed up... Well, now the end of the week so I'll post an example for those that just want to compile and find out what day of the week a given date was.
Regards,
Brian
Code:
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
int main(int argc, char *argv[])
{
char c;
int a, y, m, d;
int month, day, year;
char weekDay[][10] = {"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"};
char monthName[][10] = { "", "January", "February", "March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December"};
cout << endl << "Enter date: mm/dd/yyyy: ";
cin >> month >> c >> day >> c >> year;
a = (14 - month) / 12;
y = year - a;
m = month + 12 * a - 2;
d = (day + y + y / 4 - y / 100 + y / 400 + 31 * m / 12) % 7;
/*
cout << endl << setw(2) << setfill('0') << month << "/";
cout << setw(2) << setfill('0') << day << "/";
cout << setw(4) << setfill('0') << year << " was a ";
cout << weekDay[d] << endl << endl;
*/
cout << endl << monthName[month] << " ";
cout << setw(2) << setfill('0') << day << ", ";
cout << setw(4) << setfill('0') << year << " was a ";
cout << weekDay[d] << endl << endl;
cout << "Press `Enter' to continue . . . ";
cin.sync( );
cin.ignore( );
return EXIT_SUCCESS;
}