title: Day of the Week calendar calculator
body: <p>I'm trying to write a program which will calculate the dayof the week a date inputted by a user would fall on. I keep getting the error "warning C4700: uninitialized local variable 'year' used." I cannot figure out how to initialize that variable. Also, when  I run it I get the wrong day for the date I input. Can anyone help me?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std; 
  int main(void)
  {                                                       
  string Days[7]={"Sunday","Monday","Tuesday","Wednesday","Thursday",
  "Friday","Saturday"}; 
  
  int a,month,year,y,day,m,d;
  month=(1,2,3,4,5,6,7,8,9,10,11,12); 
  day=( 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31);
  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))&amp;7;
  
  
  cout &lt;&lt; "Welcome to 'Day Of The Week Calculator!'" &lt;&lt;endl;  //display message 
  cout &lt;&lt; "Enter Month 1 - 12:" &lt;&lt;endl;                          //prompt user for month data
  cin &gt;&gt; month;                                               //read integer from user into month
  cout &lt;&lt; "Enter day 1 - 31:" &lt;&lt;endl;                         //prompt user for day data
  cin &gt;&gt; day;                                                 //read integer from user into day 
  cout &lt;&lt; "Enter year &gt;1582:" &lt;&lt;endl;                         //prompt user for year data
  cin &gt;&gt; year;                                                //read in integer from user into year 
  cout &lt;&lt;endl &lt;&lt;"The Date: "&lt;&lt;month&lt;&lt;"/"&lt;&lt;day&lt;&lt;"/"&lt;&lt;year      //answer to day of week calculation
  &lt;&lt;" Falls on a: "&lt;&lt; Days[d]&lt;&lt;endl;
  return 0;                                                   //indicate that program ended successfully
  </code></pre>