Skip to content

Instantly share code, notes, and snippets.

@surinoel
Created July 4, 2019 10:21
Show Gist options
  • Save surinoel/1a384d0254c8965af4e979836707c986 to your computer and use it in GitHub Desktop.
Save surinoel/1a384d0254c8965af4e979836707c986 to your computer and use it in GitHub Desktop.
static void cancle_movie_ticket(void)
{
long long curtimetick, flagtick;
system("cls");
char buf[20], moviebuf[20]; memset(buf, 0, sizeof(buf)); memset(moviebuf, 0, sizeof(buf));
bool ok = false;
printf("\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t "); printf("회원 이름을 입력해주세요: "); scanf("%s", buf);
for (int i = 0; i < _msize(user) / sizeof(*user); i++) {
ok = true;
if (!strcmp(buf, user[i].name)) {
int pswd;
printf("\t\t %s님! 비밀번호를 입력하세요: ", user[i].name); scanf("%d", &pswd);
if (pswd == user[i].password) {
if (user[i].mt->seatcnt != 0) show_userinfo(user[i]);
else goto err;
}
else {
goto err2;
}
system("cls");
printf("\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t "); printf("취소할 영화이름을 입력해주세요: "); scanf("%s", moviebuf);
if (!strcmp(moviebuf, user[i].mt->movieTitle)) {
user[i].money += user[i].mt->ticketprice * user[i].mt->seatcnt;
free(user[i].mt);
user[i].mt = (struct MovieTicket *)malloc(sizeof(struct MovieTicket));
memset(user[i].mt, 0, sizeof(user[i].mt));
user[i].mt->seatcnt = 0;
}
else {
goto err2;
}
}
}
if (!ok) goto err2;
return;
err:
error_handler(5, "예매내역이 없습니다", "프로그램이 종료됩니다");
return;
err2:
error_handler(5, "사용자 입력을 다시 확인해주세요", "메뉴로 넘어갑니다");
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment