Professional Documents
Culture Documents
Mini Project: Designing A Calendar With Reminders and Coloured Background
Mini Project: Designing A Calendar With Reminders and Coloured Background
Mini Project: Designing A Calendar With Reminders and Coloured Background
DESCRIPTION:
START
We have used system(“color 5F”) command which is used to set the
default console foreground and background colour.
Colour attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground. Each digit
can be any of the following values:
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
Here 5 refers to the purple coloured background and F refers to the white
coloured foreground in this project.
The COLOR command sets ERRORLEVEL to 1 if an attempt is made to
execute the COLOR command with a foreground and background colour
that are the same.
Declare the variables y ,dd, m, nleap, count, scount, i=1, n.
The first while loop is used to calculate the no. of days in a month like ,
for January it has 31 days etc…
To print the days of a leap year we use the logic below,
A leap year is exactly divisible by 4 except for century years (years ending with
00). The century year is a leap year only if it is perfectly divisible by 400.
For example,
OUTLINE:
Enter the desired year: xxxx
Enter the month in that year: xx
Enter a date to check for reminder: x
Your reminder will be displayed.
START
Read m
Switch(m)
NO NO NO NO
1 2 3 4
YES YES YES YES
NO NO NO NO
8 7 6 5
NO NO NO
9 10 11 12
0
YES YES YES YES
#include<stdio.h>
#include<conio.h>
void main()
{ system("color 5F");
int y,dd,m,nleap,count,scount,i=1,n;
printf("\n\t\t\t\t\t\t********###CALENDAR###********");
do
scanf("%d",&y);
}while(y<1);
do
scanf("%d",&m);
}while(m<1||m>12);
if(m==4||m==6||m==9||m==11)
{
dd=30;
if(y%4==0&&y%100!=0||y%400==0)
if(m==2)
dd=29;
else
if(m==2)
dd=28;
if(m==1||m==3||m==5||m==7||m==8||m==10||m==12)
dd=31;
nleap=(y-1)/4-(y-1)/100+(y-1)/400;
dp=(y-1)*365l+nleap;
switch(m)
case 12:dp+=30;
case 11:dp+=31;
case 10:dp+=30;
case 9:dp+=31;
case 8:dp+=31;
case 7:dp+=30;
case 6:dp+=31;
case 5:dp+=30;
case 4:dp+=31;
case 3:dp+=28;
case 2:dp+=31;
case 1:dp+=1;
switch(m)
case 1: if(m==1)
printf("\n---------JANUARY--------------");
break;
case 2: if(m==2)
printf("\n--------FEBRUARY--------------");
break;
case 3: if(m==3)
printf("\n--------MARCH-----------------");
break;
case 4: if(m==4)
printf("\n--------APRIL-----------------");
break;
case 5: if(m==5)
printf("\n---------MAY------------------");
break;
case 6: if(m==6)
printf("\n----------JUNE----------------");
break;
case 7: if(m==7)
printf("\n----------JULY----------------");
break;
case 8: if(m==8)
printf("\n--------AUGUST----------------");
break;
case 9: if(m==9)
printf("\n---------SEPTEMBER------------");
break;
case 10:if(m==10)
printf("\n--------OCTOBER----------------");
break;
break;
printf("\n----------DECEMBER-----------");
break;
switch(dp%7)
case 1: count=0;
break;
case 2: count=4;
break;
case 3: count=8;
break;
case 4: count=12;
break;
case 5: count=16;
break;
case 6: count=20;
break;
}
printf("\n");
scount=count;
while(scount>0)
printf(" ");
--scount;
while(dd>=i)
if(count%28==0)
printf("\n");
printf("%3d ",i);
i++;
count+=4;
scanf("%d",&n);
switch(m)
case 1:
{if(n==1)
else if(n==26)
printf("Republic day");
else if(n==15)
else if(n==25)
else if(n==24)
else
break;
case 2:
if(n==13)
else if(n==28)
else if(n==4)
else if(n==14)
printf("Valentine's day");
else if(n==22)
break;
case 3:
if(n==20)
else if(n==8)
else if(n==3)
else if(n==15)
printf("Ramakrishna jayanthi");
else if(n==22)
else
break;
case 4:
{
if(n==22)
else if(n==23)
else if(n==7)
else if(n==14)
else if(n==2)
else
break;
case 5:
if(n==7)
else if(n==12)
else if(n==5)
printf("May day");
else if(n==8)
printf("World red cross day");
else if(n==11)
else
break;
case 6:
if(n==5)
else if(n==21)
else if(n==30)
else if(n==7)
else if(n==29)
else
break;
case 7:
{
if(n==11)
else if(n==18)
else if(n==1)
else if(n==30)
else if(n==29)
else
break;
case 8:
if(n==15)
printf("Independence day");
else if(n==6)
printf("Hiroshima day");
else if(n==9)
printf("Nagasaki day");
else if(n==7)
printf("National handloom day");
else if(n==12)
else
break;
case 9:
if(n==29)
else if(n==27)
else if(n==5)
printf("Teacher's day");
else if(n==10)
else if(n==15)
else
break;
}
case 10:
if(n==2)
printf("Gandhi Jayanthi");
else if(n==16)
else if(n==31)
else if(n==8)
else if(n==10)
else
break;
case 11:
if(n==19)
else if(n==14)
printf("Children's day");
else if(n==7)
printf("National cancer awareness day");
else if(n==13)
else if(n==12)
else
break;
case 12:
if(n==25)
printf("Christmas eve");
else if(n==24)
else if(n==10)
else if(n==1)
else if(n==4)
else
break;
}
OUTPUT:
RESULT:
Thus, the above program to design a calendar with reminders and coloured
background is executed successfully and the output is verified.
TEAM MATES:
REKHA P
VINOTHA R