-
Notifications
You must be signed in to change notification settings - Fork 0
/
FINAL PROJECT.cpp
240 lines (221 loc) · 5.15 KB
/
FINAL PROJECT.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
#include<graphics.h>
int firstweekday(int year);
void gotoxy(int x,int y){
COORD CRD;
CRD.X=x;
CRD.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),CRD);}
int firstweekday(int year)
{int day;
day = (((year - 1) * 365) + ((year - 1) / 4) - ((year - 1) / 100) + ((year) / 400) + 1) % 7;
return day;}
main()
{
int year,month,monthdays,day,dayscount=0,startingday,i; char a,b;char arr[10]; int d=194,j,e=231;
char *months[]={"January","February","March","April","May","June","July","August","September","October","November","December"};
int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int gd=DETECT,gm;
initgraph(&gd,&gm,""); int x=171; int y=110;
gotoxy(40,10);
printf("Enter the year: ");
scanf("%d",&year);
gotoxy(40,12);
printf("Enter the month: ");
scanf("%d",&i);
setcolor(GREEN);
rectangle(180,40,467,75);
if(i==1)
outtextxy(486,170,"1st Jan New Year");
if(i==2)
outtextxy(470,170,"14th Feb Valentines Day");
if(i==3)
{outtextxy(515,170,"17th Mar");
outtextxy(485,190,"Saint's Patrick Day");}
if(i==4)
outtextxy(473,170,"1st Apr: April Fool Day");
if(i==5)
outtextxy(475,170,"7th May Teachers Day");
if(i==6)
{outtextxy(518,170,"5th June");
outtextxy(470,190,"World Environment Day");}
if(i==7)
outtextxy(490,170,"1st July Joke Day");
if(i==8)
outtextxy(466,170,"20th Aug Mosquito's Day");
if(i==9)
outtextxy(465,170,"17th Sep Citizenship Day");
if(i==10)
outtextxy(459,170,"16th Oct World Food's Day");
if(i==11)
outtextxy(468,170,"18th Nov Radiology Day");
if(i==12)
{outtextxy(515,170,"10th Dec");
outtextxy(485,190,"Human Rights Day");}
if((year%4==0 && year%100==0) || (year%400==0))
days[1]=29;
startingday=firstweekday(year);
setcolor(11);
for(month=0;month<=11;month++)
{
if(month==i-1){
outtextxy(290,50,months[i-1]);
outtextxy(200,80,"Sun Mon Tue Wed Thu Fri Sat\n\n");}
x=171;
for(dayscount=0;dayscount<startingday;dayscount++)
{
outtextxy(x,110,"");
x=x+37;
}
monthdays=days[month];
if(month<=i-1)
{
for(day=1;day<=monthdays;day++)
{
x=x+37;
if(month==i-1)
{
sprintf(arr,"%d",day);
outtextxy(x,y,arr);}
if(++dayscount>6)
{
if(month==i-1)
{x=171;
y=y+30;}
dayscount=0;
}
startingday=dayscount;
}}
}
setcolor(GREEN);
for(j=1;j<=7;j++)
{
rectangle(d,75,e,285);
d=37+d;
e=e+37;
}
d=75;e=105;
for(j=1;j<=6;j++)
{
rectangle(194,d,453,e);
d=30+d;
e=e+30;
}
setcolor(GREEN);
rectangle(71,425,142,450);
rectangle(70,424,143,451);
rectangle(65,419,148,456);
setcolor(11);
outtextxy(82,430,"2-Guide");
setcolor(GREEN);
rectangle(279,425,360,450);
rectangle(278,424,361,451);
rectangle(273,419,366,456);
setcolor(11);
outtextxy(285,430,"1-Calender");
setcolor(GREEN);
rectangle(497,425,568,450);
rectangle(496,424,569,451);
rectangle(491,419,574,456);
setcolor(11);
outtextxy(505,430,"ESC-Exit");
setcolor(GREEN);
rectangle(510,105,581,150);
setcolor(11);
outtextxy(530,110,"M");
delay(100);
outtextxy(542,110,"A");
delay(100);
outtextxy(549,110,"I");
delay(100);
outtextxy(554,110,"N");
delay(100);
outtextxy(527,130,"E");
delay(100);
outtextxy(535,130,"V");
delay(100);
outtextxy(542,130,"E");
delay(100);
outtextxy(549,130,"N");
delay(100);
outtextxy(558,130,"T");
delay(100);
setcolor(11);
rectangle(510,105,581,150);
setcolor(11);
rectangle(510,104,581,151);
setcolor(GREEN);
outtextxy(530,110,"M");
delay(100);
outtextxy(542,110,"A");
delay(100);
outtextxy(549,110,"I");
delay(100);
outtextxy(554,110,"N");
delay(100);
outtextxy(527,130,"E");
delay(100);
outtextxy(535,130,"V");
delay(100);
outtextxy(542,130,"E");
delay(100);
outtextxy(549,130,"N");
delay(100);
outtextxy(558,130,"T");
delay(100);
setcolor(GREEN);
rectangle(510,105,581,150);
rectangle(509,104,582,151);
setcolor(11);
outtextxy(530,110,"M");
delay(100);
outtextxy(542,110,"A");
delay(100);
outtextxy(549,110,"I");
delay(100);
outtextxy(554,110,"N");
delay(100);
outtextxy(527,130,"E");
delay(100);
outtextxy(535,130,"V");
delay(100);
outtextxy(542,130,"E");
delay(100);
outtextxy(549,130,"N");
delay(100);
outtextxy(558,130,"T");
delay(100);
settextstyle(7,0,3);
setcolor(11);
outtextxy(40,120,"Made By");
outtextxy(20,145,"Muhammad");
outtextxy(58,170,"Talha");
a=_getch();
{system("cls");
cleardevice();}
if(a==49)
main();
if(a==50)
{settextstyle(4,0,5);
setcolor(GREEN);
outtextxy(80,10,"INSTRUCTIONS");
settextstyle(8,0,1);
outtextxy(10,90,"Enter the Year: Enter the year you desire to look in.");
outtextxy(10,120,"Enter the Month: Enter the month you desire to look in.");
outtextxy(10,150,"Main Event: Below the main event is the most ");
outtextxy(210,180," popular of your chosen month.");
outtextxy(10,210,"Calender: Press 1 to look over any other year.");
outtextxy(10,240,"Exit: Press Esc Key To Exit at any Stage.");
settextstyle(4,0,1);
outtextxy(190,350,"Press Any Key to Exit");
b=_getch();
if(b==49)
main();
}
if(a==27)
exit;
closegraph();
}