안녕하세요.
***스스로 고민해보고 정말 모르시겠다면 봐주세요.
따로 function(함수)를 만들지 않고 main으로만 구현된 초판입니다.
감사합니다.
int main()
{
int count;
char choice;
while (1)
{
printf("Enter the letter of your choice:\n");
printf("a. averngers\t\tb. beep\n");
printf("c. count\t\tq. quit\n");
choice = getchar();
switch (choice)
{
case 'a':
printf("Avengers assemble!\n");
break;
case 'b':
printf("\a\n");
break;
case 'c':
{
printf("Enter an integer : \n");
scanf("%d", &count);
for (int i = 1; i <= count; ++i)
printf("%d\n", i);
break;
}
case 'q':
{
printf("Good-bye!\n");
return;
}
default:
printf("Your choice is wrong.\nTry again.\n");
}
while (getchar() != '\n') continue;
}
return 0;
}