#include
#include
void main()
{
int odd=0,yr,mth,dt;
int jan=31,feb=0,mar=31,apr=30,may=31,june=30,july=31,aug=30,sep=31,oct=30;
int nov=31,dec=30,rem; int s[5][7];
clrscr();
cout<<"\nEnter The Year \n";
cin>>yr;
cout<<"\n Entr The Month \n";
cin>>mth;
cout<<"\n Enter The Date \n";
cin>>dt;
if(!(yr<0&&mth>12))
{ if(dt>0&&dt<31) {
if(yr%4==0)
feb=29;
else
feb=28;
yr=yr-1;
if(yr>400)
rem=yr%400;
else
rem=yr;
if(rem>300&&rem<400)
{
rem=rem%300;
odd=odd+1;
}
if(rem>200&&rem<300)
{
rem=rem%200;
odd=odd+3;
}
if(rem>100&&rem<200)
{
rem=rem%100;
odd=odd+5;
}
//cout<<"now odd is"<
// cout<<"the leap is "<
// cout<<"the ordi yre is"<
todd=todd%7;
odd=todd+odd;
//cout<<"the yr odd toal is"<
{
odd=odd%7;
}
else { }
//cout<<"\n the odd"<
switch(mth)
{
case 1:
modd=dt; break;
case 2:
modd=jan+dt; break;
case 3:
modd=jan+feb+dt; break;
case 4:
modd=jan+feb+mar+dt; break;
case 5:
modd=jan+feb+mar+apr+dt; break;
case 6:
modd=jan+feb+mar+apr+may+dt; break;
case 7:
modd=jan+feb+mar+apr+may+june+dt; break;
case 8:
modd=jan+feb+mar+apr+may+june+july+dt; break;
case 9:
modd=jan+feb+mar+apr+may+june+july+aug+dt; break;
case 10:
modd=jan+feb+mar+apr+may+june+july+aug+sep+dt; break;
case 11:
modd=jan+feb+mar+apr+may+june+july+aug+sep+oct+dt; break;
case 12:
modd=jan+feb+mar+apr+may+june+july+aug+sep+oct+nov+dt; break;
}
modd=modd%7;
// cout<<"the month odd is after devided by 7 "<
if(odd>=7)
odd=odd%7;
//cout<<"\n the odd"<
switch(odd)
{
case 0:
cout<<" THE DAY IS SUNDAY \n";
break;
case 1:
cout<<" THE DAY IS MONDAY \n";
break;
case 2:
cout<<" THE DAY IS TUESDAY \n";
break;
case 3:
cout<<" THE DAY IS WEDNESDAY \n";
break;
case 4:
cout<<" THE DAY IS THURSDAY \n";
break;
case 5:
cout<<" THE DAY IS FRIDAY \n";
break;
case 6:
cout<<" THE DAY IS SATURDAY\n";
break;
default:cout<<"wrong";
}
cout<<" s "<<"M "<<"T "<<"W "<<"T "<<"F "<<"S \n";
int y=0;
for(int i=0;i<5;i++)
{
for(int j=0;j<7;j++)
{ y++;
s[i][j+odd]=y;
cout<
cout<
}
else
{
cout<<"\ncheck the year and month and date whether valid or not";
}
}// if ends here
getch();
}

No comments:
Post a Comment