
FUTURE IS OURS
This program gives u the entire years calendar for any year strarting from year 0001 to year 5000 to the best of my knowledge... I hope this one of the rarely found and one among the valuable that I have tried out...
Source Code :::....
/*PROGRAM TO PRINT ANY ACADEMIC YEARS CALENDAR*/
#include stdio.h
#include conio.h
FILE *fp;
FILE *fp;
void ca(int);
int da(int ,int);
void main()
{
int z,i,k=0,m1=1,m2=1,y1=1,y2,j;
char a[7]={'S','M','T','W','T','F','S'};
char b[12][10]={"JANUARY","FEBRUARY","MARCH","APRIL","MAY","
{
int z,i,k=0,m1=1,m2=1,y1=1,y2,j;
char a[7]={'S','M','T','W','T','F','S'};
char b[12][10]={"JANUARY","FEBRUARY","MARCH","APRIL","MAY","
JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER",
"NOVEMBER","DECEMBER"};
long int d=0,y=0;
fp=fopen("calendar.txt","w+");
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\tENTER THE YEAR\n\n\t");
scanf("%d",&y2);
fprintf(fp,"\tCALENDAR - %d\n\n\n",y2);
while(m1=12&&y1!=y2)
{
m1=1;
y1++;
}
else
m1++;
}
d+=y;
i=d%7;
while(m2<=12)
long int d=0,y=0;
fp=fopen("calendar.txt","w+");
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\tENTER THE YEAR\n\n\t");
scanf("%d",&y2);
fprintf(fp,"\tCALENDAR - %d\n\n\n",y2);
while(m1
{
m1=1;
y1++;
}
else
m1++;
}
d+=y;
i=d%7;
while(m2<=12)
{
fprintf(fp,"\t\t%s\n\n\n",b[k]);
k++;
for(j=0;j<7;j++)
{
fprintf(fp,"%c\t",a[j]);
}
fprintf(fp,"\n");
ca(i);
z=da(m2,y2);
for(j=1;j<=z;j++)
{
if(i<=6)
{
fprintf(fp,"%d\t",j);
i++;
}
else
{
fprintf(fp,"\n%d\t",j); i=1;
}
}
fprintf(fp,"\n\n\n\n");
m2++;
}
fclose(fp);
getch();
}
void ca(int i)
{
switch(i)
{
case 0:
break;
case 1:
fprintf(fp,"\n\t");
break;
case 2:
fprintf(fp,"\n\t\t");
break;
case 3:
fprintf(fp,"\n\t\t\t");
break;
case 4:
fprintf(fp,"\n\t\t\t\t");
break;
case 5:
fprintf(fp,"\n\t\t\t\t\t");
break;
case 6:
fprintf(fp,"\n\t\t\t\t\t\t");
break;
}
}
{
switch(i)
{
case 0:
break;
case 1:
fprintf(fp,"\n\t");
break;
case 2:
fprintf(fp,"\n\t\t");
break;
case 3:
fprintf(fp,"\n\t\t\t");
break;
case 4:
fprintf(fp,"\n\t\t\t\t");
break;
case 5:
fprintf(fp,"\n\t\t\t\t\t");
break;
case 6:
fprintf(fp,"\n\t\t\t\t\t\t");
break;
}
}
int da(int m2,int y2)
{
int x=0;
if(m2<=7&&m2!=2)
{
int x=0;
if(m2<=7&&m2!=2)
{
if(m2%2==0)
x=30;
else
x=31;
}
else if(m2>7)
{
if(m2%2==0)
x=31;
else
x=30;
}
else
{
if(y2%4==0)
x=29;
else
x=28;
}
return(x);
}
{
if(m2%2==0)
x=31;
else
x=30;
}
else
{
if(y2%4==0)
x=29;
else
x=28;
}
return(x);
}
Merits ::...
*This program gives the academic calendar for any years calendar
* Includes leap year
*Very helpful in the field of astrology
*Alignment is similar to that u see in your normal wall calendar
Look out ::...
This program can be run in any C compilers... Important thing is that the output will only be displayed in a notepad file outside the compiler... This is because while displaying the entire year's calendar only a last few months are visible in DOS PROMPT after execution.... So in case of notepad file entire years calendar can be displayed....
Your comments are always welcomed....
No comments:
Post a Comment