-4
我是C新手,我需要爲項目構建一個帶有循環的菜單。 我有2個問題。C菜單 - 否則如果
1)我想添加一個字符到else,如果在主菜單按「2」後詢問某個東西,問題將會是「您是否要參加活動?」用戶可以輸入聊天「Y」或「N」後,程序會感謝用戶並中斷,其他輸入會將用戶發送到主菜單
2)我想統計已經在主菜單與節目製作時,我按下「3」,我沒有任何想法我如何將count選項與「否則,如果」
int choice;
while (1)
{
printf("Main Menu\n");
printf("\n");
printf("Please enter num:");
scanf("%d", &choice);
printf("You entered %d\n", choice);
if (choice == 4)
{
break;
}
else if (choice == 1)
printf("Returned to main menu\n");
else if (choice == 2)
printf("Are you going to the event?\n");
else if (choice == 3)
printf("number of loops that made are \n");
else if (choice == 4)
printf("Bye!\n");
else
printf("Wrong Input!\n");
}
printf("Bye!\n");
return 0;
}
1 - 我認爲我需要添加循環,但是這句話是對別人,如果循環了。 – opelka