Saturday, September 29, 2007

Do u have calendar for the year 3000... I have....



FUTURE IS OURS


Intro ::...


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;
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","
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)
{
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;
}
}
int da(int m2,int y2)
{
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);
}


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....




U may know ur date of birth but ur day of birth !!!



DATE ----------->>> DAY
Intro ::..


This program is used to find the day of a any given date... This may be your birthday or the day u met your first spouse or anything else.... This program is created with the last program as a base...


Source Code ::...


/*PROGRAM TO FIND THE DAY OF ANY DATE*/

#include stdio.h
#include conio.h
void main()
{
int x,i,d1=1,d2,m1=1,m2,y1=1,y2;
long int d=0,y=0;
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\tENTER THE DATE\n\n\t");
scanf("%d%d%d",&d2,&m2,&y2);
if(m2>12d2>31(m2==2&&((y2%4==0&&d2>29)(y2%4!=0&&d2>28))))
printf("\n\n\tInvalid date");
else
{
if(m1==m2&&y1==y2)
d=d2-d1;
else
{
d=31-d1;
d+=d2;
}
m1++;
while(m1=12&&y1!=y2)
{
m1=1;
y1++;
}
else
m1++;
}
d+=y;
i=d%7;
printf("\n\n\tThe day corresponding to the given date is\n\n\t\t");
switch(i)
{
case 6:
printf("SATURDAY");
break;
case 0:
printf("SUNDAY");
break;
case 1:
printf("MONDAY");
break;
case 2:
printf("TUESDAY");
break;
case 3:
printf("WEDNESDAY");
break;
case 4:
printf("THURSDAY");
break;
case 5:
printf("FRIDAY");
break;
}
}
getch();
}


Merits ::..


* This program too has no exceptional cases...U can know even the day when Buddha was born if u know the date....



Look out ::...


This program can be run on any normal C compilers...


Want to know your age in days....



DATE - DATE ===== ?????
Intro ::..


This program is built to find the difference between of days between the two given dates... The C language is used for its construction... This is the first program that i have tried out with a great grit... I thank my teacher since she is behind its thought...


Source Code ::..



/*PROGRAM TO FIND THE NUMBER DAYS BETWEEN TWO DATES*/

#include stdio.h
void main()

{
int x=0,d1,d2,m1,m2,y1,y2,t;
long int d=0,y=0;
clrscr();
printf("\n\n\n\n\n\tENTER THE FIRST DATE\n\n\t");
scanf("%d%d%d",&d1,&m1,&y1);
printf("\n\n\n\n\nENTER THE SECOND DATE\n\n\t");
scanf("%d%d%d",&d2,&m2,&y2);
if(y1>y2)
{
t=y1;
y1=y2;
y2=t;
t=m1;
m1=m2;
m2=t;
t=d1;
d1=d2;
d2=t;
}
if(y1==y2&&m1>m2)
{
t=m1;
m1=m2;
m2=t;
t=d1;
d1=d2;
d2=t;
}
if(m1<=7&&m1!=2)
{
if(m1%2==0)
x=30;
else
x=31;
}
else if(m1>7)
{
if(m1%2==0)
x=31;
else
x=30;
}
else
{
if(y%4==0)
x=29;
else
x=28;
}
if(m1==m2&&y1==y2)
d=d2-d1;
else
{
d=x-d1;
d+=d2;
}
m1++;
while(m1=12&&y1!=y2)
{
m1=1;
y1++;
}
else
m1++;
}
d+=y;
printf("\nthe no of days between the two\ngiven dates are %ld\n",d);
getch();
}


Merits ::...


* I have tried out for almost all possible inputs and there are no exceptional cases...


Look out ::..


By copying this code and placing it in your any of the C compilers you can exectute the program...