Question: C Programming 1. Declare an array availablePizzas of 3 PizzaIngredients elements. #include #include typedef struct PizzaIngredients_struct { char pizzaName[30]; char ingredients[70]; } PizzaIngredients; int main(void)

C Programming

1. Declare an array availablePizzas of 3 PizzaIngredients elements.

#include #include

typedef struct PizzaIngredients_struct { char pizzaName[30]; char ingredients[70]; } PizzaIngredients;

int main(void) {

/* Your solution goes here */

strcpy(availablePizzas[0].pizzaName, "Barbecue"); strcpy(availablePizzas[0].ingredients, "Beef, chicken, bacon, barbecue sauce"); strcpy(availablePizzas[1].pizzaName, "Carbonara"); strcpy(availablePizzas[1].ingredients, "Mushrooms, onion, creamy sauce"); strcpy(availablePizzas[2].pizzaName, "Ham and Cheese"); strcpy(availablePizzas[2].ingredients, "Ham, cheese, bacon");

printf("%s: %s ", availablePizzas[0].pizzaName, availablePizzas[0].ingredients); printf("%s: %s ", availablePizzas[1].pizzaName, availablePizzas[1].ingredients); printf("%s: %s ", availablePizzas[2].pizzaName, availablePizzas[2].ingredients);

return 0; }

2. Write a statement that calls a function named IncreaseItemQty, passing the variable addQty. Assign notebookInfo with the value returned by IncreaseItemQty.

#include #include

typedef struct ProductInfo_struct { char itemName[30]; int itemQty; } ProductInfo;

ProductInfo IncreaseItemQty (ProductInfo productToStock, int increaseValue) { productToStock.itemQty = productToStock.itemQty + increaseValue;

return productToStock; }

int main(void) { ProductInfo notebookInfo; int addQty = 10;

scanf("%s", notebookInfo.itemName); scanf("%d", ¬ebookInfo.itemQty);

/* Your solution goes here */

printf("Name: %s, stock: %d ", notebookInfo.itemName, notebookInfo.itemQty);

return 0; }

3. For any element in keysList with a value greater than 40, print the corresponding value in itemsList, followed by a space. Ex: If keysList = {32, 105, 101, 35} and itemsList = {10, 20, 30, 40}, print:

20 30 

#include

int main (void) {

const int SIZE_LIST = 4; int keysList[SIZE_LIST]; int itemsList[SIZE_LIST]; int i;

keysList[0] = 13; keysList[1] = 47; keysList[2] = 71; keysList[3] = 59;

itemsList[0] = 12; itemsList[1] = 36; itemsList[2] = 72; itemsList[3] = 54;

/* Your solution goes here */

printf(" ");

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!