C Program for Universal Calendar
#include #include #include #include #include #include #include #define std_year 1000 #define std_month 1 #define std_date 1 void calender(void); long yearlydiff(long year); void anaclock(void); void presentation(void); void digiclock(void); void menu(void); void main() { char ch; /********************* auto detect the driver *********************/ int gdriver,gmode; gdriver=DETECT; initgraph(&gdriver,&gmode,"c:\tc3\BGI"); /***************** clearing all staying on the screen ****************/ cleardevice(); presentation(); for(;;) { menu(); ch=getch(); if(ch=='1') calender(); else if(ch=='2') anaclock(); else if(ch=='3') digiclock(); else if(ch=='4') break; } } void calender(void) { char year_str[10],month_str[6],t[2],date_str[3], temp[10]; int year,month,i,flag,start,j,lessx,lessy,k,l; long days=0; int months[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; char *monthname[13]={"","JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE", "JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"}; char *dayname[8]={"","SAT","SUN","MON","TUE","WED","THU","FRI"}; int position[35][2]=/*{{257,210},{314,210},{371,210},{428,210},{485,210}, {542,210},{600,210},{257,270},{314,270},{371,270}, {428,270},{485,270},{542,270},{600,270},{257,330}, {314,330},{371,330},{428,330},{485,330},{542,330}, {600,330},{257,390},{314,390},{371,390},{428,390}, {485,390},{542,390},{600,390},{257,450},{314,450}, {371,450},{428,450},{485,450},{542,450},{600,450} }; */ {{187,180},{244,180},{301,180},{358,180},{415,180},{472,180},{530,180},{18 7,240}, {244,240},{301,240},{358,240},{415,240},{472,240},{530,240},{187,300},{244 ,300}, {301,300},{358,300},{415,300},{472,300},{530,300},{187,360},{244,360},{301 ,360}, {358,360},{415,360},{472,360},{530,360},{187,420},{244,420},{301,420},{358 ,420}, {415,420},{472,420},{530,420}}; int dayposition[7][2]={{257,150},{314,150},{371,150},{428,150}, {485,150},{542,150},{600,150} }; /************* clearing all thing staying on the screen ***************/ cleardevice(); /************************ year input ******************************/ for(k=1;k<640;k+=4) for(l=1;l<479;l+=4) putpixel(k,l,DARKGRAY); setcolor(LIGHTBLUE); settextstyle(8,HORIZ_DIR,4); outtextxy(50,50,"Enter the year and press enter"); outtextxy(90,80,"(between 1000 & 10000)"); for(i=0;;i++) { year_str[i]=getch(); if(year_str[i]==' ') { year_str[i]='}