Question
C Programming *Notice: I can only edit the part where it says in /* Your solution goes here */ the other part of the code
C Programming
*Notice: I can only edit the part where it says in /* Your solution goes here */ the other part of the code i can't touch it please the solution should be inside that part ad using the code provided
Question 1
Declare an array pizzasInStore of 3 PizzaIngredients elements.
#include
typedef struct PizzaIngredients_struct { char pizzaName[30]; char ingredients[70]; } PizzaIngredients;
int main(void) {
/* Your solution goes here */
strcpy(pizzasInStore[0].pizzaName, "Barbecue"); strcpy(pizzasInStore[0].ingredients, "Beef, chicken, bacon, barbecue sauce"); strcpy(pizzasInStore[1].pizzaName, "Carbonara"); strcpy(pizzasInStore[1].ingredients, "Mushrooms, onion, creamy sauce"); strcpy(pizzasInStore[2].pizzaName, "Ham and Cheese"); strcpy(pizzasInStore[2].ingredients, "Ham, cheese, bacon");
printf("%s: %s ", pizzasInStore[0].pizzaName, pizzasInStore[0].ingredients); printf("%s: %s ", pizzasInStore[1].pizzaName, pizzasInStore[1].ingredients); printf("%s: %s ", pizzasInStore[2].pizzaName, pizzasInStore[2].ingredients);
return 0; }
Question2
Write a statement that calls a function named AddToStock, passing the variable addStock. Assign mugInfo with the value returned by AddToStock.
#include
typedef struct ProductInfo_struct { char itemName[30]; int itemQty; } ProductInfo;
ProductInfo AddToStock (ProductInfo productToStock, int increaseValue) { productToStock.itemQty = productToStock.itemQty + increaseValue;
return productToStock; }
int main(void) { ProductInfo mugInfo; int addStock = 10;
scanf("%s", mugInfo.itemName); scanf("%d", &mugInfo.itemQty);
/* Your solution goes here */
printf("Name: %s, stock: %d ", mugInfo.itemName, mugInfo.itemQty);
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started