Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Define a function SetBirth, with int parameters monthVal and dayVal, that returns a struct of type BirthMonthDay. The function should assign BirthMonthDay's data member month with monthVal and day with dayVal.

#include

typedef struct BirthMonthDay_struct { int month; int day; } BirthMonthDay;

/* Your solution goes here */

int main(void) { BirthMonthDay studentBirthday; int month; int day;

scanf("%d %d", &month, &day); studentBirthday = SetBirth(month, day); printf("The student was born on %d/%d. ", studentBirthday.month, studentBirthday.day);

return 0; }

Question2

Assign Carbonara's data member caloriesPerSlice with 350 and Four Cheese's with 280.

#include #include

typedef struct PizzaInfo_struct { char pizzaName[30]; int caloriesPerSlice; } PizzaInfo;

int main(void) {

PizzaInfo availablePizzas[2];

strcpy(availablePizzas[0].pizzaName, "Carbonara"); strcpy(availablePizzas[1].pizzaName, "Four Cheese");

/* Your solution goes here */

printf("A %s pizza contains %d calories ", availablePizzas[0].pizzaName, availablePizzas[0].caloriesPerSlice); printf("A %s pizza contains %d calories ", availablePizzas[1].pizzaName, availablePizzas[1].caloriesPerSlice);

return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

=+1. What are the differences between fever and hyperthermia?

Answered: 1 week ago

Question

Discuss the key people management challenges that Dorian faced.

Answered: 1 week ago

Question

How fast should bidder managers move into the target?

Answered: 1 week ago