Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userltem. Print "Unknown" (followed by a newline) if the value of userltem does not match any of the defined options. For example, if userltem is GR_APPLES, output should be: Fruit 365290.2416604.qx3zqy7 1 #include 2 3 int main(void) { enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER}; enum GroceryItem userItem; 4 5 6 userItem = GR_APPLES; 7 8. 9. V* Your solution goes here */ 10 11 return e; 12 }
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
CODE C PLEASE 4.11.2, 4.13.1
![CHALLENGE
4.13.1: Enumerations: Grocery items.
АCTIVITY
Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userltem.
Print "Unknown" (followed by a newline) if the value of userltem does not match any of the defined
options. For example, if userltem is GR_APPLES, output should be:
Fruit
365290.2416604.qx3zqy7
1 #include <stdio.h>
2
3 int main(void) {
enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER};
enum GroceryItem userItem;
4
7
userItem
GR_APPLES;
8.
* Your solution goes here */
9
10
11
return e;
12 }](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F8185e77c-872f-43d7-af1d-d1e4a6a92688%2F3bbb2a30-2707-4e23-acb3-c443a7404dbd%2Fn53261o_processed.png&w=3840&q=75)
![CHALLENGE
4.11.2: Simon says.
АCTIVITY
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) an
user must repeat the sequence. Create a for loop that compares the two strings starting from inde>
For each match, add one point to userScore. Upon a mismatch, exit the loop using a break stateme
Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield
userScore of 4:
simonPattern: RRGBRYYBGY
userPattern: RRGBBRYBGY
365290.2416604.qx3zqy7
10
userScore =
e;
11
scanf("%s", simonPattern);
scanf ("%s", userPattern);
12
13](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F8185e77c-872f-43d7-af1d-d1e4a6a92688%2F3bbb2a30-2707-4e23-acb3-c443a7404dbd%2Fxrs46p5_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
This is multiple type question, hence only first question has been answered. The question is to write C code for the given problem.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)