C language Calendar Program Code

Download Code For Calendar In C Language Source Codes.

[c]

#include<iostream.h>
#include<conio.h>
char *months[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
void cal(int yr,int mo,int fd,int da);
void main()
{
int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
long int ndays,ldays,tdays,tydays;
int i,y,m,fday,d;
clrscr();

cout<<"Enter the YEAR & MONTH";
cin>>y>>m;

ndays=(y-1)*365l;
ldays=(y-1)/400-(y-1)/100+(y-1)/4;
tdays=ndays+ldays;

if(y%400==0&&y%1001==0||y%4==0)
days[1]=29;
else
days[1]=28;
d=days[m-1];
tydays=0;

for(i=0;i<=m-2;i++)
tydays=tydays+days[i];
tdays=tdays+tydays;
fday=tdays%7;
cal(y,m,fday,d);
}
void cal(int yr,int mo,int fd,int da)
{
int i,r,c;
clrscr();
gotoxy(25,5);
cout<<months[mo-1]<<yr;
gotoxy(5,6);
cout<<"_________________________________________________________";
gotoxy(10,7);
cout<<"Mon Tue Wed Thur Fri Sat Sun";
gotoxy(5,8);
cout<<"_________________________________________________________";
r=10;
c=11+fd*6;
for(i=1;i<=da;i++){
gotoxy(c,r);
cout<<i;

if(c<=41)
c=c+6;
else
{
c=11;
r=r+1;
}
}
gotoxy(5,16);
cout<<"_________________________________________________________";
getch();
}
[/c]

Share

About the Author

Akash Padhiyar

Visit Website

One Comment

  1. CAN U GIVE ME SOME DESCRIPTION REGARDING THIS PROGRAM OF ABOUT 2-3 PAGES.
    MEANS ABOUT THE FLOW OF PROGRAM, HOW IT GOES ??

    IF POSSIBLE PLZ MAIL ME !!!

    THANKS !!

Leave a Comment

Your email address will not be published. Required fields are marked *

*

Time limit is exhausted. Please reload CAPTCHA.