해당 강의에서 전 메뉴를 이렇게 만들었습니다.
미해결
홍정모의 따라하며 배우는 C언어
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { char input; int c = 0; printf("Enter the letter of your choice : \n"); printf("a. avengers\t b. beep\nc. count\t d. quit\n"); while ((input = getchar())) { if (input == 'a') { printf("Avengers assemble!\n"); } else if (input == 'b') { printf("b\a\n"); } else if (input == 'c') { printf("Enter an integer : \n"); scanf("%d", &c); for (int i = 1; i <= c; i++) printf("%d\n", i); } else if (input == 'd') { printf("Program is end\n"); break; } else printf("That's wrong. Another Key input please.\n"); while ((input = getchar()) != '\n') continue; printf("Enter the letter of your choice : \n"); printf("a. avengers\t b. beep\nc. count\t d. quit\n"); } return 0; } 이방법이 작동하는데 전혀 문제가 없고 잘 작동하지만, 강의에서도 그렇구 다른분들두 switch case를 많이 사용하시는 모습을 보고 전 전혀 switch case를 생각하지 않았거든요 ㅠㅠ 모자란점이 느껴져 아쉽습니다 ㅠㅠ 또한.. 함수사용도 하지않았네요 ㅠㅠ 코드가 아무래도 지저분해보이긴 한거같습니다.. integer가 아닌 경우도 만들어봐야겠습니다. 이러한 아쉬운점이 있는데 제 실력이 모자라기 때문이겠죠? ㅠㅠ
- 8.8메뉴만들기
- c
- 혼자코드작성





