-
-
Save surinoel/19ec94c0d5981c34d5076123cb2d1157 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void check_admin(int adminpswd) | |
{ | |
Movie **ptr; | |
int pswd, choicenum, price, idx; | |
long long curtimetick, flagtick; | |
char moviename[20]; | |
system("cls"); | |
printf("\n\n\n\n\n\n\n\n\n\n");printf("\t\t\t "); | |
printf("관리자 비밀번호를 입력하세요 : "); scanf("%d", &pswd); | |
if (pswd == adminpswd) { | |
choicenum = display_admin_menu(); | |
system("cls"); | |
switch (choicenum) { | |
case 1: | |
printf("\n\n\n\n\n\n\n\n\n\n"); printf("\t\t\t "); | |
printf("수정할 영화를 입력하세요 : "); scanf("%s", moviename); | |
idx = -1; | |
ptr = movielist; | |
for (int i = 0; i < _msize(ptr) / sizeof(*ptr); i++) { | |
if (!strcmp(ptr[i]->movieTitle, moviename)) { | |
idx = i; | |
} | |
} | |
if (idx == -1) goto err; | |
system("cls"); | |
printf("\n\n\n\n\n\n\n\n\n\n"); printf("\t\t\t "); | |
printf("수정할 가격을 입력하세요 : "); scanf("%d", &price); | |
if (price >= 5000 && price <= 15000) { // 일정 금액 사이일 때만 | |
change_price(idx, price); | |
} | |
else { | |
goto err; | |
} | |
break; | |
case 2: | |
dipslay_seat_admin(); | |
break; | |
default: | |
break; | |
} | |
} | |
else { | |
err: | |
error_handler(5, "사용자 입력을 다시 확인해주세요", "메뉴로 넘어갑니다"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void dipslay_seat_admin(void) | |
{ | |
Movie **ptr = movielist; | |
char moviebuf[50]; | |
int idx; | |
while (1) { | |
system("cls"); | |
printf("\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t "); printf("확인할 영화를 검색해주세요: "); | |
scanf("%s", moviebuf); | |
idx = -1; | |
for (int i = 0; i < _msize(ptr) / sizeof(*ptr); i++) { | |
if (!strcmp(ptr[i]->movieTitle, moviebuf)) { | |
idx = i; | |
} | |
} | |
if (idx == -1) { | |
error_handler(3, "사용자 입력을 다시 확인해주세요", "재입력으로 넘어갑니다"); | |
continue; | |
} | |
system("cls"); | |
printf("\n"); | |
for (int i = 0; i < _msize(ptr[idx]) / sizeof(*ptr[idx]); i++) { | |
printf("\t\t 시작시간 : %d:00 | 종료시간 : %d:00 | 러닝타임 : %d분\n", ptr[idx][i].startTime, ptr[idx][i].exitTime, ptr[idx][i].runningTime); | |
printf("\t ================================================================= \n"); | |
printf("\t\t\t\t\t SCREEN\t\t\t\t\n"); | |
printf("\t ================================================================= \n"); | |
for (int j = 0; j < _msize(ptr[idx][i].seat) / sizeof(*ptr[idx][i].seat); j++) { | |
for (int k = 0; k < _msize(ptr[idx][i].seat[j]) / sizeof(*ptr[idx][i].seat[j]); k++) { | |
printf("\t%d", j * 10 + k + 1); | |
} | |
printf("\n"); | |
for (int k = 0; k < _msize(ptr[idx][i].seat[j]) / sizeof(*ptr[idx][i].seat[j]); k++) { | |
if (ptr[idx][i].seat[j][k] == 1) printf("\to"); | |
else printf("\tx"); | |
} | |
printf("\n\n"); | |
} | |
printf("\n\n"); | |
} | |
break; | |
} | |
system("pause"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void change_price(int idx, int price) | |
{ | |
Movie *ptr = movielist[idx]; | |
for (int i = 0; i < _msize(ptr) / sizeof(*ptr); i++) { | |
ptr[i].ticketprice = price; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment