Bob’s Ice Cream sells four types of ice cream: vanilla, chocolate, mint, and strawberry. • Bob's Ice Cream sells ice cream from trucks that are parked at two different corners. They sold {$11.5, $15.75, $22, $7.25} on Saturday and {$12.75, $9.25, $16.5, $21} on Sunday [note sales are in vanilla, chocolate, mint, and strawberry order]. • Create an enum for flavors: enum flavors {vanilla, chocolate, mint, strawberry}; • Create a C program that allows a user to enter the type of ice cream sold. • Create a C program that allows a user to enter the sales data. • Load two one-dimensional arrays with Bob’s entered sales data. Only index your arrays using an enum variable (enum flavors index = vanilla; corner1Sales[index] = 11.5;) • Sum the contents of the flavors in the arrays together. • Print out the resulting flavors and their sum with Bob's total sales Note: when using fgets: 1. you'll need to make the array that holds your string +2 in size. You have to have room for the final /n and the final /0. 2. Your fgets max size has to account for the two additional characters: max string size + 2. Result should be look similar to the picture
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.
Bob’s Ice Cream sells four types of ice cream: vanilla, chocolate, mint, and strawberry.
• Bob's Ice Cream sells ice cream from trucks that are parked at two different corners.
They sold {$11.5, $15.75, $22, $7.25} on Saturday and {$12.75, $9.25, $16.5, $21} on
Sunday [note sales are in vanilla, chocolate, mint, and strawberry order].
• Create an enum for flavors:
enum flavors {vanilla, chocolate, mint, strawberry};
• Create a C
• Create a C program that allows a user to enter the sales data.
• Load two one-dimensional arrays with Bob’s entered sales data. Only index your arrays
using an enum variable (enum flavors index = vanilla; corner1Sales[index] = 11.5;)
• Sum the contents of the flavors in the arrays together.
• Print out the resulting flavors and their sum with Bob's total sales
1. you'll need to make the array that holds your
string +2 in size. You have to have room for
the final /n and the final /0.
2. Your fgets max size has to account for the two
additional characters: max string size + 2.
Result should be look similar to the picture
Step by step
Solved in 4 steps with 2 images