#include
#include
#include
#include
int dat,ye,manth;
void year(int a,int man)
{
int i,j,m=0,mon,l,k;
for(i=1;i<=a;i++)
{
if(i==a)
printf("\n YEAR %d ",i);
for(j=1;j<=12;j++)
{
if(i%4==0&&j==2)
mon=29;
else if(j==2)
mon=28;
else if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
mon=31;
else
mon=30;
if(j==1&&i==a&&j==man)
printf("\n\n JANUARY \n");
else if(j==2&&i==a&&j==man)
printf("\n\n FEBRUARY \n");
else if(j==3&&i==a&&j==man)
printf("\n\n MARCH \n");
else if(j==4&&i==a&&j==man)
printf("\n\n APRIL \n");
else if(j==5&&i==a&&j==man)
printf("\n\n MAY \n");
else if(j==6&&i==a&&j==man)
printf("\n\n JUNE \n");
else if(j==7&&i==a&&j==man)
printf("\n\n JULAY \n");
else if(j==8&&i==a&&j==man)
printf("\n\n AUGUST \n");
else if(j==9&&i==a&&j==man)
printf("\n\n SEPTEMBER \n");
else if(j==10&&i==a&&j==man)
printf("\n\n OCTOBER \n");
else if(j==11&&i==a&&j==man)
printf("\n\n NOVEMBER \n");
else if(j==12&&i==a&&j==man)
printf("\n\n DECEMBER \n");
if(i==a&&j==man)
{
printf("\n SUN MON TUE WED THU FRI SAT\n");
printf(" ");
}
for(l=1;l<=m;l++)
{
if(i==a&&j==man)
printf(" ");
}
for(k=1;k<=mon;k++)
{
if(i==a&&j==man)
{
if(i==ye&&j==manth&&k==dat)
{
textcolor(GREEN);
cprintf("%2d ",k);
m++;
continue;
}
if(m==5||m==6)
{
textcolor(RED);
cprintf("%2d ",k);
}
else if(m!=7)
{
textcolor(WHITE);
printf("%2d ",k);
}
textcolor(WHITE);
}
m++;
if(m==7||m==8)
{
if(i==a&&j==man)
{
printf("\n\n");
printf(" ");
}
m=0;
}
}
}
}
gotoxy(3,40);
// printf("\n\n\n\n\n\n\n\n\n");
printf("\n Next month (ctrl+Right Arrow): ");
printf(" Previous month(ctrl+Left Arrow):");
printf("\n\n Next year (ctrl+page Down): ");
printf(" Previous year(ctrl+Page Up):");
printf("\n\n Jump to any year (ctrl+D) ");
printf("\n\n EXIT Esc:");
// gotoxy(3,50);
}
void exit()
{
textcolor(GREEN);
clrscr();
gotoxy(20,20);
printf(" ");
char text[39]={"Thank you for useing this software :"};
for(int ii=0;ii<36;ii++)
{
delay(100);
printf("%c",text[ii]);
}
printf("\n\n");
printf(" ");
char text2[51]={"Created by Md Bellal Hossain:"};
for(ii=0;ii<29;ii++)
{
delay(100);
printf("%c",text2[ii]);
}
char text3[58]={"Student of CSE Disipline(07 Batch) :"};
printf("\n\n");
printf(" ");
for(ii=0;ii<36;ii++)
{
delay(100);
printf("%c",text3[ii]);
}
printf("\n\n");
printf(" ");
char text4[46]={"Khulna University,Khulna"};
for(ii=0;ii<24;ii++)
{
delay(100);
printf("%c",text4[ii]);
}
printf("\n\n\n\n\n\n");
printf(" ");
char text5[32]={"GOOD BYE"};
for(ii=0;ii<8;ii++)
{
delay(100);
printf("%c",text5[ii]);
}
delay(1000);
}
int pdate()
{
gotoxy(5,2);
FILE *stream;
struct ftime ft;
if ((stream = fopen("TEST.$$$","wt")) == NULL)
{
fprintf(stderr, "Cannot open output file.\n");
return 1;
}
getftime(fileno(stream), &ft);
ye= ft.ft_year+1980;
dat=ft.ft_day;
manth=ft.ft_month;
fclose(stream);
gotoxy(5,2);
printf("Present Date: %u/%u/%u",ft.ft_day,ft.ft_month,
ft.ft_year+1980);
if(ft.ft_hour>12)
printf(" Opening Time: %u:%u:%uPM\n",ft.ft_hour-12,
ft.ft_min, ft.ft_tsec * 2);
else if(ft.ft_hour==12)
printf(" Opening Time: %u:%u:%uPM\n",ft.ft_hour,
ft.ft_min, ft.ft_tsec * 2);
else
printf(" Opening Time: %u:%u:%uAM\n",ft.ft_hour,
ft.ft_min, ft.ft_tsec * 2);
// gotoxy(80,50);
return 0;
}
int main(void)
{
int tt=0,t=0,asci;int y,b;
char arr[7]={"WELCOME"};
textcolor(WHITE);
textbackground(BLUE);
clrscr();
gotoxy(30,25);
delay(800);
for(int i=0;i<7;i++)
{
delay(500);
printf("%c",arr[i]);
}
gotoxy(50,45);
printf("\n\n ENTER continue: Esc EXIT");
while(tt!=2)
{
l:
char ch=getch();
asci=(int)ch;
switch(asci)
{
case 13:
tt=2;
break;
case 27:
tt=2;
t=1;
break;
default:
goto l;
}
}
if(t!=1)
{
clrscr();
FILE *stream;
struct ftime ft;
if ((stream = fopen("TEST.$$$","wt")) == NULL)
{
fprintf(stderr, "Cannot open output file.\n");
return 1;
}
getftime(fileno(stream), &ft);
ye=y= ft.ft_year+1980;
manth=b=ft.ft_month;
dat=ft.ft_day,
pdate();
year(y,b);
}
while(t!=1)
{
ll:
char ch=getch();
asci=(int)ch;
switch(asci)
{
case 118:
{
clrscr();
y++;b=1;
pdate();
year(y,b);
}
break;
case -124:
{
clrscr();
y--;b=1;
pdate();
year(y,b);
}
break;
case 116:
{
clrscr();
if(b==12)
b=1;
else
b++;
pdate();
year(y,b);
}
break;
case 115:
{
clrscr();
if(b==1)
b=12;
else
b--;
pdate();
year(y,b);
}
break;
case 4:
{
clrscr();
gotoxy(25,25);
printf("Enter your desired Year:");
int yr;
scanf("%d",&yr);
clrscr();
pdate();
b=1;y=yr;
year(y,b);
}
break;
case 27:
{
t=1;
break;
}
default:
goto ll;
}
}
exit();
return 0;
}
0 comments:
Post a Comment