Write a C program to create a menu that allows a user to select which takeaway option they require. If the user chooses option "1" that indicates "Toasted cheese and tomato sandwich" If the user chooses option "2" that indicates "Toasted chicken and mayonnaise sandwich" If the user chooses option "3" that indicates "Cheese burger with chips" If the user chooses option "4" that indicates "Medium chips" If the user chooses any other number, the screen must display the following error message: "Incorrect selection. Please choose again" The program must perform the following functionality: i. Display the list of menu items and numbers. ii. Prompt the user to select an item. Use a SWITCH statement to determine the menu item chosen and display the correct choice on the screen. IF YOU DONT USE A SWITCH STATEMENT THE C PROGRAM EILL BE REGARDED AS INCORRECT. If an incorrect item is chosen, display the error message and loop back to re-prompt the user to choose an option again. You have to decide which would be the most appropriate loop construct for the program. Chose among the following loop constructs: 1. For 2. While 3. Do while
Write a C program to create a menu that allows a user to select which takeaway option they require.
If the user chooses option "1" that indicates "Toasted cheese and tomato sandwich"
If the user chooses option "2" that indicates "Toasted chicken and mayonnaise sandwich"
If the user chooses option "3" that indicates "Cheese burger with chips"
If the user chooses option "4" that indicates "Medium chips"
If the user chooses any other number, the screen must display the following error message: "Incorrect selection. Please choose again"
The program must perform the following functionality:
i. Display the list of menu items and numbers.
ii. Prompt the user to select an item.
Use a SWITCH statement to determine the menu item chosen and display the correct choice on the screen. IF YOU DONT USE A SWITCH STATEMENT THE C PROGRAM EILL BE REGARDED AS INCORRECT.
If an incorrect item is chosen, display the error message and loop back to re-prompt the user to choose an option again.
You have to decide which would be the most appropriate loop construct for the program. Chose among the following loop constructs:
1. For
2. While
3. Do while
Step by step
Solved in 2 steps with 2 images