Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Cal

Cal

Ratings: (0)|Views: 5 |Likes:
Published by Ramesh

More info:

Published by: Ramesh on Sep 12, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

09/12/2010

pdf

text

original

 
Code :/*Coded byTapan Kumar MishraElectrical Engg.IGIT SarangFor any querryEmail:titu_igit@rediffmail.comDate of Submission:5.11.2005*/#include<stdio.h>#include<dos.h>#include<conio.h>/**********************************************Global Variables***********************************************/struct date d;int currentday,currentmon,currentyear;unsigned long far *t=MK_FP(0X40,0X6C);unsigned char far *scr=MK_FP(0XB800,0);/**********************************************Function Prototype Declaration***********************************************/void writechar(char c,int row,int col,char attr);long int curtime(void);void showcale(int,int);unsigned char getkey(void);/***********************************************Function to Scan the Scan code of the arrow keys************************************************/unsigned char getkey(void){char c;if(kbhit()){asm xor ah,ah;asm int 22;asm mov c,ah;return c;}return 0;}void main(){int year,i,m;char c;getdate(&d);//function which gives the current dateyear=d.da_year;currentyear=year;m=(int)d.da_mon;currentmon=m;currentday=(int)d.da_day;showcale(year,m);for(;;){curtime();i=(int)getkey();if(i==16)exit();if(i==72)
 
showcale(++year,m);if(i==80)showcale(--year,m);if(i==75){if(--m==0){m=12;year--;}showcale(year,m);}if(i==77){if(++m==13){m=1;year++;}showcale(year,m);}}}/**********************************************showcale() Print The calender***********************************************/void showcale(int year,int m){int date[]={31,28,31,30,31,30,31,31,30,31,30,31};int i,d=0;char *month[]={"January","February","March","April","May","June","July","August","September","October","November","December"};if(year%4==0&&year%100!=0year%400==0)//to check the year leap or notdate[1]=29;//to calculate the 1st day of the yearfor(i=1900;i<year;i++)if(i%4==0&&i%100!=0i%400==0)d=d+2;elsed=d+1;//to calculate the 1st day of the month of the corresponding yearfor(i=0;i<m-1;i++)d=d+date[i];//to print the calender of the month;clrscr();printf("%s%d",month[m-1],year);printf("MonTueWedThuFriSatSun");for(i=0;i<d%7;i++)printf("");for(i=1;i<=date[m-1];i++){if((i+d)%7==0)printf("%d",i);elseprintf("%d",i);}

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->