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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#include <iostream.h>
#include <time.h>
#include<string.h>
void main ()
{
int Day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
char nameday[7][10]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int mo,dy,yr,c=0,j;
cout<<"Enter Years:";
cin>>yr;
if(yr<1928) ;
yr-=1928;
j=(yr)/4;
yr%=7;
cout<<"Enter month:";
cin>>mo;
if(mo<1 || mo>12) ;
cout<<"Enter day:";
cin>>dy;
if(dy<1 || dy>31) ;
for(int i=0;i<mo-1;i++)
{
c+=Day[i];
}
dy+=yr;
c+=dy;
c+=j;
c%=7;
cout<<nameday[c]<<endl;
}
|