-
Notifications
You must be signed in to change notification settings - Fork 1
/
수능 dday
459 lines (458 loc) · 9.33 KB
/
수능 dday
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
#include "헤더.h"
int dday()
{
int recursive = 1;
while (recursive)
{
system("cls");
suneong_1();
Sleep(500);
system("cls");
FILE* fpdday;
int i = 0, j = 0, f = 0, file = 0;
char suneong[MAX], date[MAX], fdelete1[MAX];
int year = 0, month = 0, day = 0, tmp = 0, sum = 0, syear = 1, smonth = 0, sday = 1, fsave = 0, fdelete = 100, interchoose;// 2021-11-06
int f1[MAX], f2[MAX], f3[MAX], f4[MAX], f5[MAX], f6[MAX], f7[MAX], s1, s2, s3, s4, s5, s6, s7;
const char s2022[MAX] = "2021-11-18";
const char s2023[MAX] = "2022-11-17";
const char s2024[MAX] = "2023-11-16";
const char s2025[MAX] = "2024-11-14";
time_t timer = 0;
struct tm t;
timer = time(NULL);
localtime_s(&t, &timer);
printf("수능 D-Day\n");
printf("오늘은 %d년 %d월 %d일입니다.\n", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday);
suneong_2();
scanf_s("%d", &interchoose);
system("cls");
if (interchoose == 1)
{
fopen_s(&fpdday, "savedday.txt", "r");
if (fpdday == NULL)
{
데이터x();
}
else
{
데이터o();
while (fpdday != NULL && fscanf_s(fpdday, "%d %d %d %d %d %d %d", &f1[fsave], &f2[fsave], &f3[fsave], &f4[fsave], &f5[fsave], &f6[fsave], &f7[fsave]) != EOF)
{
fsave++;
}
fclose(fpdday);
if (fpdday != NULL)
{
while (1)
{
printf("■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■\n\n");
for (f = 0; f < fsave; f++)
{
file = f + 1;
printf("#%d: %d년 %d월 %d일 부터 %d년 수능까지 %d년 %d월 %d일 남았었습니다.\n", file, f1[f], f2[f], f3[f], f4[f], f5[f], f6[f], f7[f]);
printf("---------------------------------------------------------------------\n\n");
}
printf("■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■\n\n");
printf("삭제하고 싶은 데이터가 있으시면 해당 데이터의 넘버를 눌러주세요(없으면 0):");
scanf_s("%s", fdelete1, MAX);
system("cls");
tmp = 0; i = 0;
while (fdelete1[i] != '\0')
{
tmp = tmp * 10 + (int)(fdelete1[i] - 48);
i++;
}
if (tmp <= fsave && tmp >= 0)
{
break;
}
}
fdelete = tmp;
tmp = 0, i = 0;
}
if (fdelete != 0 && fpdday != NULL)
{
fdelete--;
fopen_s(&fpdday, "savedday.txt", "w");
for (f = 0; f < fdelete; f++)
{
fprintf(fpdday, "%d %d %d %d %d %d %d \n", f1[f], f2[f], f3[f], f4[f], f5[f], f6[f], f7[f]);
}
for (f = fdelete + 1; f < fsave; f++)
{
fprintf(fpdday, "%d %d %d %d %d %d %d \n", f1[f], f2[f], f3[f], f4[f], f5[f], f6[f], f7[f]);
}
fclose(fpdday);
}
}
system("pause");
system("cls");
continue;
}
if (interchoose == 2)
{
몇학년도수능();
scanf_s("%s", suneong, 9);
system("cls");
if (strcmp(suneong, "exit") == 0)
{
continue;
}
if (strcmp(suneong, "2025") > 0)
{
printf("수능 예정일이 정해지지 않았습니다.\n\n");
system("pause");
continue;
}
if (strcmp(suneong, "2022") < 0)
{
이미지나간수능날짜();
system("pause");
continue;
}
if (strcmp(suneong, "2022") == 0)
{
while (s2022[j] != '-')
{
tmp = tmp * 10 + (int)(s2022[j] - 48);
j++;
}
}
if (strcmp(suneong, "2023") == 0)
{
while (s2023[j] != '-')
{
tmp = tmp * 10 + (int)(s2023[j] - 48);
j++;
}
}
if (strcmp(suneong, "2024") == 0)
{
while (s2022[j] != '-')
{
tmp = tmp * 10 + (int)(s2024[j] - 48);
j++;
}
}
if (strcmp(suneong, "2025") == 0)
{
while (s2022[j] != '-')
{
tmp = tmp * 10 + (int)(s2025[j] - 48);
j++;
}
}
year = tmp - (t.tm_year + 1900);
month = 11 - (t.tm_mon + 1);
tmp = 0;
int mmon = (t.tm_mon + 1);
if (strcmp(suneong, "2022") == 0)
{
j = 8;
while (s2022[j] != '\0')
{
tmp = tmp * 10 + (int)(s2022[j] - 48);
j++;
}
if (tmp < t.tm_mday)
{
month--;
day = 31 - t.tm_mday;
day = day + tmp;
}
else
{
day = tmp - t.tm_mday;
}
}
else if (strcmp(suneong, "2023") == 0)
{
j = 8;
while (s2023[j] != '\0')
{
tmp = tmp * 10 + (int)(s2023[j] - 48);
j++;
}
if (tmp < t.tm_mday)
{
month--;
day = 31 - t.tm_mday;
day = day + tmp;
}
else
{
day = tmp - t.tm_mday;
}
}
else if (strcmp(suneong, "2024") == 0)
{
j = 8;
while (s2024[j] != '\0')
{
tmp = tmp * 10 + (int)(s2024[j] - 48);
j++;
}
if (tmp < t.tm_mday)
{
month--;
day = 31 - t.tm_mday;
day = day + tmp;
}
else
{
day = tmp - t.tm_mday;
}
}
else if (strcmp(suneong, "2025") == 0)
{
j = 8;
while (s2025[j] != '\0')
{
tmp = tmp * 10 + (int)(s2025[j] - 48);
j++;
}
if (tmp < t.tm_mday)
{
month--;
day = 31 - t.tm_mday;
day = day + tmp;
}
else
{
day = tmp - t.tm_mday;
}
}
if (month < 0)
{
year--;
month = 12 + month;
}
if (year < 0)
{
이미지나간수능날짜();
}
else
{
tmp = 0;
i = 0;
while (suneong[i] != '\0')
{
tmp = tmp * 10 + (int)(suneong[i] - 48);
i++;
}
s1 = t.tm_year + 1900;
s2 = t.tm_mon + 1;
s3 = t.tm_mday;
s4 = tmp;
s5 = year;
s6 = month;
s7 = day;
얼마나남았습니다(year, month, day);
데이터저장여부();
scanf_s("%d", &fsave);
fopen_s(&fpdday, "savedday.txt", "a");
if (fsave == 1)
{
fprintf(fpdday, "%d %d %d %d %d %d %d \n", s1, s2, s3, s4, s5, s6, s7);
}
fclose(fpdday);
}
system("pause");
continue;
}
if (interchoose == 3)
{
임의의날짜입력();
scanf_s("%s", date, MAX);
while (strcmp(date, "exit") != 0)
{
tmp = 0;
for (i = 0; i < 4; i++)
{
tmp = tmp * 10 + (int)(date[i] - 48);
}
year = tmp;
tmp = 0;
for (i = 5; i < 7; i++)
{
tmp = tmp * 10 + (int)(date[i] - 48);
}
month = tmp;
tmp = 0;
for (i = 8; i < 10; i++)
{
tmp = tmp * 10 + (int)(date[i] - 48);
}
day = tmp;
if (date[0] > '2' || date[1] > '0' || date[2] > '2' || date[3] > '6' || date[5] > '1' || date[8] > '3' || date[4] != '-' || date[7] != '-')
{
이상한날짜();
scanf_s("%s", date, MAX);
continue;
}
else if (month > 12)
{
이상한날짜();
scanf_s("%s", date, MAX);
continue;
}
else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
{
if (day > 31)
{
이상한날짜();
scanf_s("%s", date, MAX);
continue;
}
}
else if (month == 4 || month == 6 || month == 9 || month == 11)
{
if (day > 30)
{
이상한날짜();
scanf_s("%s", date, MAX);
continue;
}
}
else if (month == 2)
{
if (day > 28)
{
이상한날짜();
scanf_s("%s", date, MAX);
continue;
}
}
break;
}
if (strcmp(date, "exit") == 0)
{
continue;
}
s1 = year;
s2 = month;
s3 = day;
몇학년도수능();
scanf_s("%s", suneong, MAX);
system("cls");
if (strcmp(suneong, "exit") == 0)
{
continue;
}
if (strcmp(suneong, "2025") > 0)
{
printf("수능 예정일이 아직 정해지지 않았습니다.");
system("pause");
continue;
}
if (strcmp(suneong, "2022") < 0)
{
이미지나간수능날짜();
system("pause");
continue;
}
tmp = 0;
i = 0;
while (suneong[i] != '\0')
{
tmp = tmp * 10 + (int)(suneong[i] - 48);
i++;
}
s4 = tmp;
i = 0;
j = 0;
tmp = 0;
while (s2022[j] != '-')
{
tmp = tmp * 10 + (int)(s2022[j] - 48);
j++;
}
year = tmp - s1;
month = 11 - s2;
tmp = 0;
j = 8;
if (strcmp(suneong, "2022") == 0)
{
while (s2022[j] != '\0')
{
tmp = tmp * 10 + (int)(s2022[j] - 48);
j++;
}
day = tmp - s3;
}
else if (strcmp(suneong, "2023") == 0)
{
year++;
while (s2023[j] != '\0')
{
tmp = tmp * 10 + (int)(s2023[j] - 48);
j++;
}
day = tmp - s3;
}
else if (strcmp(suneong, "2024") == 0)
{
year = year + 2;
while (s2024[j] != '\0')
{
tmp = tmp * 10 + (int)(s2024[j] - 48);
j++;
}
day = tmp - s3;
}
else if (strcmp(suneong, "2025") == 0)
{
year = year + 3;
while (s2025[j] != '\0')
{
tmp = tmp * 10 + (int)(s2025[j] - 48);
j++;
}
day = tmp - s3;
}
if (day < 0)
{
month--;
day = 31 + day;
}
if (month < 0)
{
year--;
month = 12 + month;
}
if (year < 0)
{
이미지나간수능날짜();
}
else
{
얼마나남았습니다(year, month, day);
s5 = year;
s6 = month;
s7 = day;
데이터저장여부();
scanf_s("%d", &fsave);
fopen_s(&fpdday, "savedday.txt", "a");
if (fsave == 1)
{
fprintf(fpdday, "%d %d %d %d %d %d %d \n", s1, s2, s3, s4, s5, s6, s7);
}
if (fpdday != NULL)
{
fclose(fpdday);
}
}
system("pause");
system("cls");
continue;
}
if (interchoose == 4)
{
system("cls");
printf("메인 화면으로 가는 중...");
Sleep(500);
break;
}
}
return 0;
}